D
D
danforth2016-01-10 21:14:36
PHP
danforth, 2016-01-10 21:14:36

How to clean the "city" field from garbage?

Buyers drive any kind of dregs into the city field, such as “Kyiv warehouse No. 25”, or “Kyiv region, smt. Vasiliv, house. 24, apt. 17".
The problem is that the city field is used in delivery plugins, and all of them are tied to the API (make a request to the server, get a list of branches, and delivery costs). In our case, the servers refuse, because. there is no city with the name "Kyiv warehouse No. 25".
Maybe someone has a regular season lying around that cleans the city field from spaces, the first comma, and other things?
It is desirable that Ukrainian characters are taken into account, and such cities as "Kamenets-Podolsky" are not filtered.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
D', 2016-01-10
@Denormalization

How to clean the "city" field from garbage

Make a city selection from the drop-down list (c) Cap

X
xmoonlight, 2016-01-10
@xmoonlight

Dictionary and intersection of sets.
No other way.

E
Eugene, 2016-01-11
@n1ger

Are you writing this for delivery by new mail?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question