首页 > 编程语言 > 详细

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

时间:2015-02-28 18:41:57      阅读:378      评论:0      收藏:0      [点我收藏+]

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)

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!