stringToList (VBScript)


/ Published in: Visual Basic
Save to your folder(s)

Takes a delimited string and a the delimiter, and returns a dynamic arrary


Copy this code and paste it in your HTML
  1. Function stringToList(AString, ADelimt)
  2.  
  3. Dim theList()
  4. Dim work
  5. Dim c1, arCount
  6.  
  7. work = AString
  8. c1 = 1
  9. arCount = -1
  10. Do While (c1 > 0)
  11. c1 = InStr(work,ADelimt)
  12.  
  13. If c1 > 0 Then
  14. arCount = arCount + 1
  15. ReDim Preserve theList(arCount)
  16.  
  17. theList(arCount) = Left(work,(c1-1))
  18.  
  19. work = Mid(work,c1+1,Len(work))
  20. End If
  21. Loop
  22.  
  23. arCount = arCount + 1
  24. ReDim Preserve theList(arCount)
  25. theList(arCount) = work
  26. stringToList = theList
  27.  
  28. End Function

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.