VB .net and string

Hey Guys

I have a string that i need to remove all information after the equal sign. an example of my string is below. so what i am trying to do is when it is done parsing it would only show T1. i would use the char count but i cant because i will have up to 4 characters in the begining. any ideas?

T1 = Testing Instance 1
T123 = Testing Instance 123
Chris_WareAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
käµfm³d 👽Connect With a Mentor Commented:
Dim result As String = source.Substring(0, source.IndexOf("="c)).Trim()

Open in new window

0
 
Chris_WareAuthor Commented:
that was quick :)
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
You can also use Split():
Dim result As String = source.Split("="c)(0).Trim()

Open in new window

0
All Courses

From novice to tech pro — start learning today.