VB.NET Split() Function Help

I have a variable strStringToBeSplit which contains the following string (quotes included in the string): "\\esxvm1.facultystaff.local\Memory\Memory Overcommit (1 Minute Avg)"

I split this string using the \ character as the delimiter.

I expect the second value in the array storing the split text to return this string (quotes excluded): "esxvm1.facultystaff.local"

The second value of my array always comes up empty. What am I doing wrong?

Dim myValue As String = strStringToBeSplit
Dim strSplitValues() As String = Split(myValue, "\")
txtTextBox.Text = strSplitValues(1) ' comes out blank
Who is Participating?
Mike TomlinsonMiddle School Assistant TeacherCommented:
The value you want is at the third slot (index #2).  The first and second value are blank because there is nothing in front of the first slash, and nothing between the first and second slash, so they are empty strings.
mbritojrAuthor Commented:
Ahhhhh, two \'s there...obviously been staring at this code too long. Thanks for that.
mbritojrAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.