AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Stringsplit Help

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Tue May 23, 2006 5:34 pm    Post subject: Stringsplit Help Reply with quote

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

PostPosted: Tue May 23, 2006 5:56 pm    Post subject: Reply with quote

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
View user's profile Send private message
Guest






PostPosted: Tue May 23, 2006 5:57 pm    Post subject: Reply with quote

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

PostPosted: Tue May 23, 2006 5:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
Guest






PostPosted: Tue May 23, 2006 6:09 pm    Post subject: Reply with quote

Works perfectly thanks for the tip!
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group