Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

substring and return the value after a specific character

"Testing.BSMain, Text: Start Page"

I would like to substring the value above and returning me only the value after the ": " in vb.net. How can i do that?

like image 300
Fire Hand Avatar asked Jun 21 '12 02:06

Fire Hand


2 Answers

Assumes no error checking:

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

which simply splits the phrase by the colon and returns the second part.

To use SubString, try this:

Dim test As String = "Testing.BSMain, Text: Start Page"
Dim phrase As String = test.Substring(test.IndexOf(":"c) + 1)
like image 95
LarsTech Avatar answered Oct 02 '22 12:10

LarsTech


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);
like image 22
Nudier Mena Avatar answered Oct 02 '22 14:10

Nudier Mena