An example of Regex.Split in VB.net

Rajnilari2015
Posted by Rajnilari2015 under VB.NET category on | Points: 40 | Views : 322
Dim inputText = "UserName: RNA Team" & vbCr & vbLf & "                              Country: India"
inputText.Split(New String() {vbCr & vbLf}, StringSplitOptions.None).Where(Function(s) s.IndexOf(":"C) <> -1).[Select](Function(s) s.Trim()).ToList().ForEach(Function(line)
Dim txt = Regex.Split(line, ":")
Console.WriteLine("{0} {1}", txt(0), txt(1))

End Function)

Result
----------
UserName RNA Team
Country India
Forum DNF
Section Code

Comments or Responses

Login to post response