pdidow
asked on
Need a function to take a string, and return numbers in that string
The function will be passed
ie
thepath + picnum1256.jpg
and so on
needs to return:
1256
help!
ie
thepath + picnum1256.jpg
and so on
needs to return:
1256
help!
what language do you want that in?
ASKER
VB.NET
simple... use regex
Dim r As New System.Text.RegularExpress ions.Regex ("[^0-9]*" ) '<-- one liner
MsgBox(r.Replace("thepath + picnum1256.jpg", "")) 'example 1.will display 1256
MsgBox(r.Replace("Hello..1 23,4+5~6&7 *8(9)0", "")) 'example 2. will display 1234567890
Have Fun!
Pratap
Dim r As New System.Text.RegularExpress
MsgBox(r.Replace("thepath + picnum1256.jpg", "")) 'example 1.will display 1256
MsgBox(r.Replace("Hello..1
Have Fun!
Pratap
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.