Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Feedback on: irt.org FAQ Knowledge Base Q8

irt.org | About | Feedback | 1044 [ previous next ]

Feedback on:
irt.org FAQ Knowledge Base Q8

Sent by
Lutz Kretzschmar on April 05, 2000 at 12:10:34:

Worth:
Very worth reading

Comments:
Both functions fail for input with decimal places.
Here is my version:

function thousands(str)
{
var saveStr = "" + str;
var decipos=saveStr.indexOf('.');
var deciStr="";
if (decipos>=0)
{
deciStr+=saveStr.substring(decipos,100);
saveStr=saveStr.substring(0,decipos);
}
if (saveStr.length < 4) return str;
var revStr = reverseIt(saveStr);
var newStr = '';
for (var i=0;i {
if (i>0 && (i%3)==0) newStr += ',';
newStr += revStr.charAt(i);
}
newStr=reverseIt(newStr);

if (decipos>=0)
{
newStr+=deciStr;
}
return(newStr);

}



Other feedback on 'irt.org FAQ Knowledge Base Q8' - show all


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 21st December 2007. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.