Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Initialize
- 'http://www.gunawantw.me, http://gunawantw.wordpress.com
- Dim FruitList(4) As String
- FruitList(0) = "Jeruk"
- FruitList(1) = "Jambu"
- FruitList(2) = "Apel"
- FruitList(3) = "Nanas"
- FruitList(4) = "Durian"
- Call RemoveFromList("Apel",FruitList)
- Msgbox gwImplode(FruitList,":")
- End Sub
- Function gwImplode(v As Variant,sep As String) As String
- Dim s As String
- Dim i As Integer
- s=""
- For i=0 To UBound(v)
- If i = UBound(v) Then
- s = s + v(i)
- Else
- s = s + v(i) + sep
- End If
- Next
- gwImplode = s
- End Function
- Function RemoveFromList (Value As Variant, ValueList As Variant)
- Dim tmpValueList() As String
- x = 0
- Redim Preserve tmpValueList(x)
- Forall vals In ValueList
- If Not Value = vals Then
- Redim Preserve tmpValueList(x)
- tmpValueList(x) = vals
- x = x + 1
- End If
- End Forall
- RemoveValueFromList = tmpValueList
- End Function
Add Comment
Please, Sign In to add comment