I am having 2 Textbox in my application. 1 for Source address and another for Destination Address. Both are AutoComplete textbox and I am getting Data from Google Maps API.
Source Address == SHAHIBAUGUNDERBRIDGE,Shahibagh,Ahmedabad,Gujarat
Destination Address == CGRoad,ShreyasColony,Navrangpura,Ahmedabad,Gujarat
Now what i want is to find the City Name which user has enter from the string. I tried different ways but as we can see that format of Address String is not fixed I am not able to get the City Name. I figure out one thing which is common to get city name is that it will always before the last “,”. As you can see that City name -> Ahmedabad in both the String is before the last (COMMA)”,”. But still I am struggling to get the City Name. If any one has any idea please kindly help me.
If it always the second to last then try