Jump to content

String Evaluations


Recommended Posts

yea, using "[^\w]" takes out every thing that is not a letter or number, or underscore.

from the helpfile:

'^' means :Match any character not in the set. e.g. [^0-9] matches any non-digit. To include a caret (^) in a set, put it after the beginning of the set or escape it (\^).

'\w' means : Match any "word" character: a-z, A-Z, 0-9 or underscore (_).

it works, i used it in my recent project today. works great...

you could just use: "[^0-9]"

Edited by billthecreator

[font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap

Link to comment
Share on other sites

Hi,

I have an array with values in 7 digit like this,

235,568

456.568

587,265

But the i need the array value without commas like this,

235568

456568

587265.

Any string function will do this

Thanks

My vote goes to StringReplace(). But there is nothing wrong with StringRegExpReplace().

;
#include <Array.au3>; Display purposes only

; Remove commas only
Local $aArray[3] = ["235,568","456.568","587,265"]
for $x = 0 to UBound($aArray)-1
    $aArray[$x] = StringReplace($aArray[$x],",","")
Next

_ArrayDisplay($aArray)
;
Link to comment
Share on other sites

My vote goes to StringReplace(). But there is nothing wrong with StringRegExpReplace().

;
#include <Array.au3>; Display purposes only

; Remove commas only
Local $aArray[3] = ["235,568","456.568","587,265"]
for $x = 0 to UBound($aArray)-1
    $aArray[$x] = StringReplace($aArray[$x],",","")
Next

_ArrayDisplay($aArray)
;
thats too much code. what i posted is one line. and plus, you would have to add more cause he has a '.' period in one of the strings.

[font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap

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...