.net - split string before hyphen - asp.net c# -


i have string :

10989898 - test1 

or example:

123178239182 - test2 

i need output this:

in first case:

10989898  

in second case:

123178239182 

means value before hyphen. how can that?

string result = thestring.substring(0, thestring.indexof("-")).trim(); 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -