|
I know in JavaScript I can display a date in the local format using toLocaleString() , is there an easy way to do this for a number?
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
The same function can be applied to numbers. See here: http://www.tutorialspoint.com/javascript/javascript_builtin_functions.htm[^].
Here an example:
<html>
<body>
Test number formatting with locale.
</body>
<script type="text/javascript">
var num = 100234.56789;
alert(num.toLocaleString());
</script>
</html>
In my browser with german settings the number is rendered as 100.234,56789, which is exactly the expected behaviour.
Regards,
Manfred
|
|
|
|
|
Thanks, I just could not find it; brain fart on my part.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
Sh*t Farts happen from time to time!
Cheers!
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
|
|
|
|