EvAsion Posted May 24, 2008 Share Posted May 24, 2008 (edited) OK, i have a string like this 'H24O18C19' How can i put a comma between 'the end of a series of numbers' and a letter so: 'H24,O18,C19' i was thinking something like this. $string = "H24O18C19" $replace = StringRegExpReplace($string, "\d(\w)*?",",") msgbox(0,"",$replace) Edit: see bottom post. Edited May 25, 2008 by EvAsion |-- Periodic Table --||-- Dynamic Class Timetable --||-- Navigation in Counter-Strike --| Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 24, 2008 Moderators Share Posted May 24, 2008 $string = "H24O18C19" $replace = StringRegExpReplace($string, "\w\d+","\0,") msgbox(0,"",StringTrimRight($replace, 1)) 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. Link to comment Share on other sites More sharing options...
EvAsion Posted May 24, 2008 Author Share Posted May 24, 2008 (edited) $string = "H24O18C19" $replace = StringRegExpReplace($string, "\w\d+","\0,") msgbox(0,"",StringTrimRight($replace, 1))Woah, thanks. that was quick Edited May 24, 2008 by EvAsion |-- Periodic Table --||-- Dynamic Class Timetable --||-- Navigation in Counter-Strike --| Link to comment Share on other sites More sharing options...
EvAsion Posted May 24, 2008 Author Share Posted May 24, 2008 (edited) Oh and one more thing If i have 2 capital letters next to each other, or a noncapital next to a capital, how can i put a 1 between them(or if i have a capital letter then white space or nothing, put a 1 after the capital letter)? So 'HeHP' becomes 'He1H1P1' How can i put a , in a string like 'He232' between the end of the letters and the start of the numbers (becoming 'He,232'), regardless of how many letters/numbers there are on each side? Edited May 25, 2008 by EvAsion |-- Periodic Table --||-- Dynamic Class Timetable --||-- Navigation in Counter-Strike --| 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