Monday, October 27, 2008

LotusScript equivalents for the @Implode

Function ImplodeString(vInput As Variant, sDelimiter As String) As String
'LotusScript equivalents for the @Implode
If Datatype(vInput) < 12 Then
ImplodeString = vInput
Exit Function
End If

Forall vItem In vInput
If vItem <> "" Then sTmp = sTmp & vItem & sDelimiter
End Forall
If Right(sTmp,Len(sDelimiter)) = sDelimiter Then
ImplodeString = Left(sTmp, Len(sTmp) - Len(sDelimiter))
Else
ImplodeString = sTmp
End If
End Function

No comments: