“Testing.BSMain,文本:起始页”
我想对上面的值进行子串化,并只返回vb.net中“:”之后的值。我怎样才能做到这一点?
假设没有错误检查:
Dim phrase As String = "Testing.BSMain, Text: Start Page".Split(":")(1)
它只是用冒号分割短语并返回第二部分。
要使用 SubString,试试这个:
Dim test As String = "Testing.BSMain, Text: Start Page"
Dim phrase As String = test.Substring(test.IndexOf(":"c) + 1)
您可以使用 split 方法返回冒号后的值:
Dim word as String = "Testing.BSMain, Text: Start Page"
Dim wordArr as String() = word.Split(":")
Dim result as String = wordArr(1);
如果提出的解决方案对您不起作用,我是这样做的:
result= Split("Testing.BSMain, Text: Start Page", ":")(1)