Posted By

adrianparr on 07/07/11


Tagged

map long longitude latitude as3 lat lng co-ordinates latlng


Versions (?)

AS3 Get latitude and longitude from a bracketed string


 / Published in: ActionScript 3
 

  1. var latLngStr:String = "(51.559340379647914, -0.2835899591445923)";
  2. trace(latLngStr);
  3.  
  4. var lat:Number = Number(latLngStr.substring(1, latLngStr.length-1).split(",")[0]);
  5. trace(lat);
  6.  
  7. var lng:Number = Number(latLngStr.substring(1, latLngStr.length-1).split(",")[1]);
  8. trace(lng);
  9.  
  10. // OUTPUT
  11. // (51.559340379647914, -0.2835899591445923)
  12. // 51.559340379647914
  13. // -0.2835899591445923

Report this snippet  

You need to login to post a comment.