Jump to content

Remove Characters and whitespace in a string?


Recommended Posts

I have been looking in the forum and hlpfile and cannot find anything like StringUpper and StringLower that will remove everything but a digit from a string? what I need is to be able to paste a telephone number in and as most people put a space or dash or even a dot I want to be able to submit and it remove all but the digits in a string.. Any ideas?

Link to comment
Share on other sites

MsgBox(0, "Regular Expression Replace Test", StringRegExpReplace("419-333-5555", "[^0-9]", ""))

^Yup very powerful function! I'm starting to like it too :)

Check this out:

$my_pnumber = "My Phone Number is: (419)333-5555"
MsgBox(0, "Info", $my_pnumber)
MsgBox(0, "Extracted Phone Number", StringRegExpReplace($my_pnumber, "[^0-9]", ""))

[font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...