21st December 2010 - Update - I would no longer use this code as there is a Split function already to use in LotusScript.
Split(sInput,sDelimiter).
The code below is still useful to know, but I would use the split from no onwards.
Please note I did not write this, but it is useful code to share.
Function LSExplode(ByVal sInput As String, ByVal sDelimiter As String) As Variant
'LotusScript equivalents for the @Explode
Dim sOutput As String
Dim aOutput() As String
Dim nPos As Integer
Dim nNextPos As Integer
sOutput = sInput
ReDim aOutput(0)
nPos = InStr(sOutput, sDelimiter)
While nPos <> 0
aOutput(UBound(aOutput)) = Left(sOutput, nPos - 1)
sOutput = Right(sOutput, Len(sOutput) - Len(sDelimiter) - nPos + 1)
nPos = InStr(sOutput, sDelimiter)
ReDim Preserve aOutput(UBound(aOutput) + 1)
Wend
aOutput(UBound(aOutput)) = sOutput
LSExplode = aOutput
End Function
No comments:
Post a Comment