Converting a Pipe Delimited List of Values into a Generic List (of String)
Sometimes it's helpful to convert data into a different format before further processing. In this case, converting the delimited list to a generic list of string will make it more friendly for loops.Public Shared Function CreateSupplierList(strSupplierPipedList As String) As List(Of String)
Try
' split the pipe delimited list into an array and then add to a generic list
Dim strSupplierList() As String = strSupplierPipedList.Split("|")
Dim lst As New List(Of String)
For intCount = 0 To strSupplierList.Length - 1
lst.Add(strSupplierList(intCount))
Next
Return lst
Catch ex As Exception
Return New List(Of String)
End Try
End Function
No comments:
Post a Comment