Q:

Cutting a string Until a particular character occurs

whats the code to cut or trim a string until a particular character is hit.
for example,
dim TestString as String = "REG - REGULAR"

output of this string after cutting should be, 
"REG" 

The code should be able to cut the string until it reaches this character "-". 
It should also remove the white spaces.
whats the code for doing this task.
I am using vb.net.
Thank You

A:

You can use String.Substring
TestString = TestString.Substring(0,TestString.IndexOf('-')).Trim()

