Parse GoogleMarker Coordinates i.e Lat and Long
Hey I am I receiving a string values as such "(53.32000501118541, -6.223390102386475)"
How can I parse this string to seperate the 2 values and remove the "(" 开发者_如何学Pythonand ")"
Cheers
You could do a simple replace of the brackets and then split by the comma.
String[] coords = "(53.32000501118541,-6.223390102386475)"
.Replace("(",String.Empty).Replace(")",String.Empty).Split(',');
This will give you a string array containing the 2 values you want.
coords[0] will == "53.32000501118541"
coords[1] will == "-6.223390102386475"
I assume you get a GLatLng value and you would like to extract lat and lng. You can use the lat() and lng() functions to do that, without parsing and extracting data from the string.
精彩评论