Koerveter Posted February 20, 2008 Posted February 20, 2008 Is there anyway to turn a string into an array with 2characters in each arraydimension? Please help Thanks in advance!
narayanjr Posted February 20, 2008 Posted February 20, 2008 (edited) $stringLen = StringLen($String) dim $arry[$stringLen + 1] for $s = 1 to $stringLen step 2 $array[$s] = StringMid($string, $s, 2) next I didnt test it but thats the basic idea unless i had an epic brain fart and was totally wrong Edited February 20, 2008 by narayanjr
weaponx Posted February 20, 2008 Posted February 20, 2008 (edited) #include<Array.au3> $string = "aabbccddeeffg" $re = StringRegExp($string, '(?U).{2}|.', 3) _ArrayDisplay($re) Edited February 20, 2008 by weaponx
Koerveter Posted February 20, 2008 Author Posted February 20, 2008 (edited) $stringLen = StringLen($String) dim $arry[$stringLen + 1] for $s = 1 to $stringLen step 2 $array[$s] = StringMid($string, $s, 2) nextoÝ÷ Ù8Zµ©f¢Ëp¢¹w}Ó«®ì=«¢+Ù¥´ÀÌØíÉÉålÀÌØíÍÑÉ¥¹1¸¬Åt(ÀÌØí¬ôÀ)½ÈÀÌØíÌôÄѼÀÌØíÍÑÉ¥¹1¸ÍÑÀÈ(ÀÌØíÉÉålÀÌØítôMÑÉ¥¹5¥ ÀÌØíÍÑÉ¥¹°ÀÌØḭ́Ȥ(ÀÌØí¬ô¬Ä)¹á That code will work! Thanks again! Edited February 20, 2008 by Koerveter
weaponx Posted February 20, 2008 Posted February 20, 2008 Did you look at the code I posted? Its one line to create the array this way.
Koerveter Posted February 20, 2008 Author Posted February 20, 2008 Did you look at the code I posted? Its one line to create the array this way.Yeah, just tried it out, works like a charm! BIG THANKS TO YOU! ;D
narayanjr Posted February 20, 2008 Posted February 20, 2008 yeah weaponx's way is alot better ive never really used StringRegExp so i just told you the way i knew i am probably gonna look into it now im gonna need something like that soon i think
Moderators SmOke_N Posted February 20, 2008 Moderators Posted February 20, 2008 StringRegExp($string, '(?U).{2}|.', 3)StringRegExp($string, '.{1,2}', 3) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Xenobiologist Posted February 20, 2008 Posted February 20, 2008 The winner takes it all #include<Array.au3> Global $string = "123456789" Global $re = StringRegExp($string, '..|.', 3) _ArrayDisplay($re) Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
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