Jump to content
Sign in to follow this  
venkat

String Evaluations

Recommended Posts

venkat

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

Share this post


Link to post
Share on other sites
BrettF
billthecreator

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

Share this post


Link to post
Share on other sites
BrettF
Malkey

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)
;

Share this post


Link to post
Share on other sites
billthecreator

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

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  

×