firehawk777 — 2011-02-22T04:00:43-05:00 — #1
I am having an issue with converting a set of coordinates from a string to a number.
The string I receive after I receive them from the json string is formatted like this "(-28.45417, 153.33635)" that's every thing inside the quotation marks including brackets.
So I tried spitting the string at the "," and then Farray=parseFloat()
then on the Farray and Farray
It appears Farray still works out to be NaN though parseFloat() did get the correct longitude which is Farray:D.
Can anyone see how I get the Farray to be a number?
logic_ali — 2011-02-22T09:14:32-05:00 — #2
Farray will contain (-28.45417 , which cannot be evaluated as a number.
Farray = Number( Farray.replace( /[^\\d\\.\\-\\+]/g, "" );
firehawk777 — 2011-02-24T18:23:34-05:00 — #3
Thanks I solved this by using PHP before the coods were sent :
$coords = trim($coords, "(..)");
though your method would also work.