ExtensionMethod.NET Home of 846 C#, Visual Basic, F# and Javascript extension methods


Returns a string list from a delimited string where you provide the delimiter.


''' <summary>
''' Populates a list with the contents of a delimited string.
''' </summary>
''' <param name="ls"></param>
''' <param name="buf"></param>
''' <param name="delimiter"></param>
''' <returns></returns>
''' <remarks></remarks>
<Extension()> _
Public Function FromDelimitedString(ByVal ls As List(Of String), ByVal buf As String, ByVal delimiter As String) As List(Of String)            
    Dim items() As String = Split(buf, delimiter)
    Return items.ToList
End Function


Dim buf As String = "Bill|Jim|John|James|Jacob"
Dim ls As New List(Of String)
ls = ls.FromDelimitedString(buf, "|")

Author: Blake Pell

Submitted on: 25 mrt 2010

Language: VB

Type: System.String<T>

Views: 3150