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) if (decipos>=0) } Other feedback on 'irt.org FAQ Knowledge Base Q8' - show all
{
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);
{
newStr+=deciStr;
}
return(newStr);