'ASP Classic Method to Extract City from Address String

I am looking for a method to extract only the city from an address string in ASP Classic, is there a way I can do this, or resources i can read?

eg: C. del Esperanto, 17B, 03503 Benidorm, Alicante, Spain. I want just Benidorm, the address strings will always be in the same format



Solution 1:[1]

Split on comma, then on the 3rd one (2 in the array), split on space, and take the second (1 in array)

Give this a try

addressSplit1 = Split(address, ",")

addressSplit2 = Split(addressSplit1(2), " ")

city = addressSplit2(1)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mike Irving