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