GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
How can i make the distance Output shorter ?  XML
Forum Index -> FAQ - frequently asked questions
Author Message
kasimir61



Joined: 13/05/2008 04:07:10
Messages: 5
Location: Germany
Offline


Hi,
i work on an Request Modul for Wikipedia and have the following Problem..

in my Line (Code) i read the KM from nearby Wikipedia in this form..

Code:
"<br>Entfernung: ", item.distance, " KM"));


It will show me Results like that :
Entfernung: 8.621993412293858 KM

How can i reduce this Output to 8.62 KM, so that the Preview is easy to read ?
Can any give me some assist ??

Regards
Kasimir
[WWW]
marc



Joined: 08/12/2005 07:39:47
Messages: 4412
Offline

Hi Kasimir

You are right there are too many digits. I have truncated them to four.

If you want to truncate them further you can use the javascript functions to do so. You can multiply the number by 100, convert it to an integer and divide it again by 100 to get two digits.

Best

Marc

[WWW]
kasimir61



Joined: 13/05/2008 04:07:10
Messages: 5
Location: Germany
Offline

Hi Marc,
thank you for assist, i have change it now..

Regards
Kasi
[WWW]
 
Forum Index -> FAQ - frequently asked questions
Go to:   
Powered by JForum 2.1.5 © JForum Team