i am using gmail contacts api but the address is all in one string. is there any standard parser to parse a single string into a proper address object with the following fields:
Street Address 1
Street Address 2
City
State
Zip
i am using gmail contacts api but the address is all in one string. is there any standard parser to parse a single string into a proper address object with the following fields:
Street Address 1
Street Address 2
City
State
Zip
If you are getting this data from the google contact and you happen to be tapping into <gd.postalAddress>
Take look at <gd:structuredPostalAddress>
instead, where you won't have to parse since it will have the elements broken out for you already.
Though there were some bugs in it earlier this year, they may be worked out by now
This SO thread addresses the same issue for Java -- but the selected answer is language agnostic, it just shows how to form a URL from the unstructured address and send it for parsing to Google Maps (with its wealth of information about city names, street names, etc).
This other SO thread has much more discussion and proposes many solutions, including one providing complete, stand-alone Visual Basic code.
Do you need help translating the VB (or other solutions) to C#?
There is not a standard parser for addresses; You might look at the suggestions in this question: http://stackoverflow.com/questions/16413/parse-usable-street-address-city-state-zip-from-a-string but it seems US centric. There's also the recommendation of using the google maps API. This is actually very useful, but it's rate limited.
I suspect it depends very much on the class you are using and the configuration you use to call the api. Perhaps you could post an example of the string you receive. is it not xml or json already?
Does anybody have an Idea, how to get the postaladdress detail information like ZIP, Street and City out of the API in VB or C# .NET?
Please help, I really would need a solution. Thank you! If someone has code for this issue, could you send me an email to [email protected]?