我試圖獲取分隔符右側的字符串「|」而左邊的任何東西都可以忽略。將分隔符右側的字符串
我嘗試以下,但它給我的價值觀向左
Dim s As String = "John Smith | 09F2"
Console.WriteLine(s.Substring(0, s.IndexOf("|")))
Console.WriteLine(s.Split(CChar("|"))(0))
Console.ReadKey()
結果是:約翰·史密斯。我想要09F2的價值。
我也試過下面的代碼行:
Dim strEmployeeInfo As String = cmbSelectEmployee.Text
Dim employeeID = Microsoft.VisualBasic.Right(strEmployeeInfo, strEmployeeInfo.IndexOf("|"))
但這個結果是史密斯| 09F2。再次,我只需要09F2