0

How to extract "51.50431" and "-0.1133" from LatLng(51.50431, -0.1133) using jquery.

Tried using substring() but not helpful as numbers in LatLng(51.50431, -0.1133) keep on changes in different ranges. Like some time it can come as LatLng(51.50, -0.1). Any help?

1 Answer 1

1

Regular expressions to the rescue:

'LatLng(51.50, -0.1)'.match(/LatLng\(([^,]+),\s*([^)]+)\)/)

// ["LatLng(51.50, -0.1)", "51.50", "-0.1"]
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.