Link to home
Start Free TrialLog in
Avatar of pdidow
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!

Avatar of tomvergote
tomvergote
Flag of United States of America image

what language do you want that in?
Avatar of pdidow
pdidow

ASKER

VB.NET
simple... use regex

        Dim r As New System.Text.RegularExpressions.Regex("[^0-9]*") '<-- one liner
        MsgBox(r.Replace("thepath + picnum1256.jpg", "")) 'example 1.will display 1256
        MsgBox(r.Replace("Hello..123,4+5~6&7*8(9)0", "")) 'example 2. will display 1234567890


Have Fun!
Pratap
ASKER CERTIFIED SOLUTION
Avatar of pratap_r
pratap_r
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial