| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Tue May 23, 2006 5:34 pm Post subject: Stringsplit Help |
|
|
How would i go about splitting this into city state zip. Right now its in one var seperated by spaces.
El Paso TX 79901
or
Huston Tx 79808
The problem is if the city has a space in its name it throws everything off.
Thx |
|
| Back to top |
|
 |
Greg
Joined: 22 Dec 2005 Posts: 246
|
Posted: Tue May 23, 2006 5:56 pm Post subject: |
|
|
Hint:
The number of characters from the right will always be 8. So read from the right first. Then just grab whatever is left. |
|
| Back to top |
|
 |
Guest
|
Posted: Tue May 23, 2006 5:57 pm Post subject: |
|
|
| how about making sure the last variable in the split has to be a NUMBER. (if var is type) |
|
| Back to top |
|
 |
Aybra
Joined: 16 May 2006 Posts: 58
|
Posted: Tue May 23, 2006 5:58 pm Post subject: |
|
|
| Code: |
String = Huston Tx 79808
StringTrimRight, city, String, 9
StringLen, count, city
count := count + 2
StringMid, state, String, %count%, 2
StringRight, zip, String, 5
msgbox %city% : %state% : %zip%
return
|
Tested, but make sure there is no {SPACE} after the whole thing or you will need to reset the numbers.
btw, i think its Houston |
|
| Back to top |
|
 |
Guest
|
Posted: Tue May 23, 2006 6:09 pm Post subject: |
|
|
| Works perfectly thanks for the tip! |
|
| Back to top |
|
 |
|