I am using the Google direction API to get itineraries based on points that can be cities only (not addresses, countries, or any POI).
I would like to parse the city name out of the response, but the API return a somewhat cumbersome string that includes postcodes, states, countries, etc. Nevertheless, it appears that this format is not always the same, which makes it somewhat dangerous to try to get a sub-string out it. Example:
link 1 This call returns Australian locations names with postcodes, states, and country.
"start_address": "Albury NSW 2640, Australia",
"end_address": "Bendigo VIC 3550, Australia",
link 2 this call returns French locations that have no region nor postcode.
start_address": "Reims, France",
end_address": "Metz, France",
Any thoughts?