Jump to content
Sign in to follow this  
HeXetic

Get numbers from a string

Recommended Posts

HeXetic

Hopefully there is a quick an easy solution to this but I couldn't see any solution in the help file.

Basically I want to get the integers values out of a string. For example I have the string "IT Manual 18" but I jut want to get the number 18 from it.

Thanks in advance.

Share this post


Link to post
Share on other sites
aommaster

Are they all in the format of:

IT Manual ##

If so, then just use a stringtrimleft function, strip the whitespace if you need. If you want it to be changed from a string to a number, use the number() function.

Share this post


Link to post
Share on other sites
HeXetic

Yeah they are all in the format of IT Manual ## so stringtrimleft should work just fine. Thanks very much.

Share this post


Link to post
Share on other sites
BrettF

My Solution. I am just learning RegExp, so one of the more experienced users might have a better solution... :)

CODE
$string = "It Manual # 18"

$ret = StringRegExpReplace ($string, "[^0-9]", "")

MsgBox (0, "", $ret)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.