Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parsing Addresses
Message
From
13/04/2001 19:55:34
 
 
To
13/04/2001 19:34:07
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00495481
Message ID:
00495494
Views:
9
>>I have a client whose City State ZIP line is an absolute mess and rather than have them hand code all the changes, I was wondering if the Fox World would have a better way.
>
>You could start with this:
>
>lcString = 'Sauk Rapids, MN  56379'
>
>* First get out all of the multiple spaces and junk out.
>lcString = chrtran(lcString, ',' + chr(9), space(2))
>do while space(2) $ lcString
>	lcString = StrTran(lcString, space(2), space(1))
>enddo
>
>lnStartZip = rat(space(1), lcString) + 1
>?'Zip: ' + substr(lcString, lnStartZip)
>lnStartState = rat(space(1), lcString, 2) + 1
>?'State: ' + substr(lcString, lnStartState, lnStartZip - lnStartState)
>?'City: ' + substr(lcString, 1, lnStartState - 2)
Your code is wonderful for the example you undertook to parse. The thread originator needs to provide us some samples of the "mess" if we're going to be able to give him any meaningful guidance.
Previous
Reply
Map
View

Click here to load this message in the networking platform