venkat Posted June 17, 2009 Share Posted June 17, 2009 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 Link to comment Share on other sites More sharing options...
billthecreator Posted June 17, 2009 Share Posted June 17, 2009 StringRegExpReplace("456.568", "[^\w]", "") [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 More sharing options...
BrettF Posted June 17, 2009 Share Posted June 17, 2009 StringReplace? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
billthecreator Posted June 17, 2009 Share Posted June 17, 2009 (edited) 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 June 17, 2009 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 More sharing options...
BrettF Posted June 17, 2009 Share Posted June 17, 2009 I think we can safely say most of the string functions will do it... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Malkey Posted June 17, 2009 Share Posted June 17, 2009 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 ThanksMy 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 More sharing options...
billthecreator Posted June 17, 2009 Share Posted June 17, 2009 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now