Add the Tokens in a Delimited List to a Collection

Tuesday Nov 19th 2002 by John Dawson
Share:

This routine simply adds each token in a delimited list to a collection:

Public Sub AddListToCollection_(ByRef cCollection As Collection, _List As String, Delimiter As String)    Dim llDelimiterPos As Long    Dim lsWorkingList As String    lsWorkingList = List    llDelimiterPos = InStr(1, lsWorkingList,_       msCOMMA, vbTextCompare)    Do While llDelimiterPos > 0      cCollection.Add Mid$(lsWorkingList, 1,_       llDelimiterPos - 1)      lsWorkingList = Mid$(lsWorkingList,_       llDelimiterPos + 1)      i = i + 1      llDelimiterPos = InStr(1, lsWorkingList,_       msCOMMA, vbTextCompare)    Loop    If Len(lsWorkingList) > 0 Then      cCollection.Add lsWorkingList    End IfEnd Sub

Share:
Home
Mobile Site | Full Site
Copyright 2017 © QuinStreet Inc. All Rights Reserved