Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parsing Addresses
Message
De
13/04/2001 19:55:34
 
 
À
13/04/2001 19:34:07
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00495481
Message ID:
00495494
Vues:
10
>>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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform