views:

18

answers:

2

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 "(" and ")"

Cheers

+1  A: 

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"
Jamie Dixon
Thanks man that worked nicely
StevieB
A: 

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.

Vafello