"mm" <mansj.caiway.nl> wrote in message
news:jo********************************@4ax.com...
Hi all
I have a string example like this
TSOP65P640X120-20N M 0 0 0 3 9 0 20 1 0
The first number in this case is 6 but it can be between 0 and 9
The first number can be on place between 2 an 6
How do I get the string before the first number (TSOP)
TIA
Mans
Since you say the first number's max position is 6, then this won't take
too many resources
This code does not validate or check for string index out of bounds errors,
but may give you an idea of another approach.::::
'------------------------------------------------------------
Private Function getFirstChars(stringIn as String) as String
Dim stringOut as String = ""
Dim n as integer = 0
Do While not IsNumeric(stringIn.Substring( n, 1))
stringOut &= stringIn.Substring(n,1)
n += 1
Loop
Return stringOut
End Function
'-----------------------------------------Use it like this
strMyString = getFirstChars( strBigString)