|
Posted by petersprc on 07/08/07 23:47
To preserve negative numbers, you can replace these:
$x = preg_replace('/[\+\-]/', '', $loc[1]);
[...]
$y = preg_replace('/[\+\-]/', '', $loc[2]);
With:
$x = str_replace('+', '', $loc[1]);
[...]
$y = str_replace('+', '', $loc[2]);
I noticed the original example had stripped the negative sign.
On Jul 8, 6:03 pm, houghi <hou...@houghi.org.invalid> wrote:
> petersprc wrote:
> > Here's a script which will convert the URL to an ITN:
>
> > <?
>
> <snip excelent script>
>
> Mmm. Small problem if there are negative numbers:http://tinyurl.com/2uepg3orhttp://maps.google.com/maps?f=d&hl=en&geocode=&saddr=Golf+Links+Rd%2F...
> gives
> 624864|5370626|Golf Links Rd/R151|4|
> 625296|5371877|Golf Links Rd/R151|1|
> 634913|5371349|R167/St Mary's Bridge|1|
> 635492|5371389|Wellington Quay|1|
> 635500|5371498|Dominic's St|3|
>
> Where it should be
> -624864|5370626|Golf Links Rd/R151|4|
> -625296|5371877|Golf Links Rd/R151|1|
> -634913|5371349|R167/St Mary's Bridge|1|
> -635492|5371389|Wellington Quay|1|
> -635500|5371498|Dominic's St|3|
>
> Any idea?
>
> houghi
> --
> ________________________ Open your eyes, open your mind
> | proud like a god don't pretend to be blind
> | trapped in yourself, break out insteadhttp://openSUSE.org | beat the machine that works in your head
[Back to original message]
|