Hi Joel
it depends of several things (and that's why software extracting addresses automatically, like quickbook, often are making a poor job out of it)
By example:
- Is the zipcode always at the end?
- Is the zipcode always there?
- Is there always a state?
- is there always a "," after the city?
- are there always ONLY 2 lines in the address?
If the answer is YES to all these questions then the code would be something like that (not tested so bugs are probable)
sAddress is string
sLine2 is string
sAddress=extractring(Orig,1,CR)
sLine2=extractstring(Orig,2,CR)
sCity is string=Extractstring(sLine2,1,",")
sZip is string=Extractstring(sLine2,1," ",FromEnd)
sState is string=Extractstring(sLine2,2," ",FromEnd)
If the answer is no to any of the questions above then you must have code testing the actual formatting of the address to decide in what case you are (with or without zip code by example), and then use the coding appropriate in each case.
Best regards