Trim USA off of Google Autocomplete Address

Just curious how I would go about trimming the country off of an address from Google Autocomplete before it gets saved to the db.

All countries or just USA?

I would say all countries, although my app is primarily focused on the USA.

So Google Auto Complete returns a formatted address (123 Fake St Exampleville, TX, 80522, USA)

I just want to trim off the USA so its just street, city, state, zip.

As server connect has no pos() style function I think the only method I can think of is to use split() to split the string into an array then rebuild the string in a repeat based on the count() of elements from the array missing out the last element

1 Like

Thank you so much!