Jump to content
Sign in to follow this  
AyJay

Help about strings..

Recommended Posts

i have a string that is

11111111111111111111

11111111111111111111

11111111111111111111

in an edit box for example, and when i click a button, i want it to display

11 11 11 11 11 11 11 11

11 11 11 11 11 11 11 11

11 11 11 11 11 11 11 11

in the edit box, how would i do that?

Thanks.

Share this post


Link to post
Share on other sites

Somthing like this:

$newdata = StringRegExpReplace($data, "(\d{2})", "\1 ")

Share this post


Link to post
Share on other sites

umm, can you explain how that works? and how do u do it for other numbers? like '12345678900987654321'. i tried searching for it in the help file, but no topics, might be old hh.

Edited by AyJay

Share this post


Link to post
Share on other sites

Grab a beta newer than 3.2.1.8 ( I think) StringRegExp And StringRegExpReplace was out for a while.

Depending on how old your version of autoit you have it should work. If you cant find it in the help file you have to go to the online docs (but be warned the regexp engine has changed).

\d matches digits. So you get a match everytime you have to digits. The two digits are placed in \1 so the replace string will give you two digits and a space.

Then there is some global searching flags you have to figure out and probably a descission to make about an array.

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  

×
×
  • Create New...