Unique Elements of a String in Lotuscript Only

Author: Tripp W Black

Created: 05/27/2000 at 05:04 AM

 

Category:
Notes Developer Tips
Agents, LotusScript

Try this... pass in a variant array and get a uniqued one back.

Sub Unique(vSourceArray As Variant)
Dim iFound As Integer
Dim sTargetArray() As String

Redim sTargetArray(0) As String
sTargetArray(0) = ""

Forall sText In vSourceArray
iFound = False
Forall sNewText In sTargetArray
If sText = sNewText Then
iFound = True
Exit Forall
End If
End Forall
If Not iFound Then
If sTargetArray(0) ="" Then ' First time
sTargetArray(0) = sText
Else
Redim Preserve sTargetArray(Ubound(sTargetArray)+1)
sTargetArray(Ubound(sTargetArray)) = sText
End If
End If
End Forall

vSourceArray = sTargetArray
End Sub



previous page