The location field in User Object is not following a definite pattern

Sometime its returning
City, Country
Country
City,Country Code

If i want to collect City from user Object i will miss out some time (refer eg2)
If i want to collect country alone i will get Country code(refer eg.3)

How can i extract country and city from user object?

Is there any other way to do this?

As stated in the User object documentation, this field is user-defined (and may be null), so it is not possible to assume a specific pattern.