gunawantw

Remove From List in Lotus Script

Jan 22nd, 2021 (edited)
500
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub Initialize
  2.     'http://www.gunawantw.me, http://gunawantw.wordpress.com
  3.     Dim FruitList(4) As String
  4.     FruitList(0) = "Jeruk"
  5.     FruitList(1) = "Jambu"
  6.     FruitList(2) = "Apel"
  7.     FruitList(3) = "Nanas"
  8.     FruitList(4) = "Durian"
  9.    
  10.     Call RemoveFromList("Apel",FruitList)
  11.    
  12.     Msgbox gwImplode(FruitList,":")
  13.    
  14. End Sub
  15.  
  16. Function gwImplode(v As Variant,sep As String) As String
  17.     Dim s As String
  18.     Dim i As Integer
  19.     s=""
  20.     For i=0 To UBound(v)
  21.         If i = UBound(v)  Then
  22.             s = s + v(i)
  23.         Else
  24.             s = s + v(i) + sep
  25.         End If
  26.     Next   
  27.     gwImplode = s
  28. End Function
  29.  
  30. Function RemoveFromList (Value As Variant, ValueList As Variant)
  31.     Dim tmpValueList() As String
  32.     x = 0
  33.     Redim Preserve tmpValueList(x)
  34.     Forall vals In ValueList
  35.         If Not Value = vals Then
  36.             Redim Preserve tmpValueList(x)
  37.             tmpValueList(x) = vals
  38.             x = x + 1
  39.         End If
  40.     End Forall
  41.     RemoveValueFromList = tmpValueList
  42. End Function
Add Comment
Please, Sign In to add comment