码迷,mamicode.com
首页 > 编程语言 > 详细

LotusScript提升大字符串拼接函数(功能类似java中StringBuffer)

时间:2015-02-28 18:42:53      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:domino

LotusScript提升大字符串拼接函数(功能类似java中StringBuffer),代码如下:

Class StringBuffer
        Public count As Integer        
        Private arr() As String
        Private size As Integer
        Private increment As Integer
        
        Sub New(Byval a As Integer)
                Redim arr(a)
                increment=a
                count=0
        End Sub
        
        Sub add(Byval a As String)
                Me.push a
        End Sub        
        
        Sub push(Byval a As String)
                size=Ubound(arr())
                If count>=size Then
                        Redim Preserve arr(size+increment)
                End If
                arr(count)=a
                count=count+1
        End Sub
        
        Function collapse(Byval a As String) As String
                Dim sTemp As String
                If count>0 Then
                        Redim Preserve arr(count-1)        
                        sTemp=Join(arr, a)
                End If
                collapse=sTemp
        End Function
        
        Function getArray() As Variant
                If count>0 Then
                        Redim Preserve arr(count-1)
                Else
                        Redim arr(0)
                End If
                getArray=arr
        End Function
        
        Function clear
                count=0
        End Function
End Class


 

 

LotusScript提升大字符串拼接函数(功能类似java中StringBuffer)

标签:domino

原文地址:http://blog.csdn.net/gavid0124/article/details/43987769

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!