Split string to the right of delimiter
I am trying to obtain the string to the right of the delimiter "|" and
anything to the left can be ignored.
I tried the following, but it gives me the values to the left
Dim s As String = "John Smith | 09F2"
Console.WriteLine(s.Substring(0, s.IndexOf("|")))
Console.WriteLine(s.Split(CChar("|"))(0))
Console.ReadKey()
Result is: John Smith. I want the 09F2 value.
I also tried the following lines of code:
Dim strEmployeeInfo As String = cmbSelectEmployee.Text
Dim employeeID = Microsoft.VisualBasic.Right(strEmployeeInfo,
strEmployeeInfo.IndexOf("|"))
But the result of that is Smith | 09F2. Again I only need the 09F2
No comments:
Post a Comment