Substring and return value after a specific character

"Testing .BSMain, text: start page

I would like to fine-tune the value above and return me only the value after the ":" in vb.net. How can i do this?

+6
source share
2 answers

No error checking required:

Dim phrase As String = "Testing.BSMain, Text: Start Page".Split(":")(1) 

which simply breaks the phrase with a colon and returns the second part.

To use SubString, try the following:

 Dim test As String = "Testing.BSMain, Text: Start Page" Dim phrase As String = test.Substring(test.IndexOf(":"c) + 1) 
+16
source

you can use the split method to return the value after the colon :

  Dim word as String = "Testing.BSMain, Text: Start Page" Dim wordArr as String() = word.Split(":") Dim result as String = wordArr(1); 
+7
source

Source: https://habr.com/ru/post/918622/


All Articles