Reply to Re: Making a file from a long Google URL

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация