Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

Feedback on: irt.org FAQ Knowledge Base Q8, April 05, 2000 at 12:10:34:

You are here: 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

©2018 Martin Webb