NOTE!! This function MUST have FormatNumber
also provided.)
========================================================================
function FormatCurrency(num,decimalNum,bolLeadingZero,bolParens,bolCommas)
/**********************************************************************
IN:
NUM - the number to format
decimalNum - the number of decimal places to format the number to
bolLeadingZero - true / false - display a leading zero for
numbers between -1 and 1
bolParens - true / false - use parenthesis around negative numbers
bolCommas - put commas as number separators.
RETVAL:
The formatted number!
**********************************************************************/
{
var tmpStr = new String(FormatNumber(num,decimalNum,bolLeadingZero,bolParens,bolCommas));
if (tmpStr.indexOf("(") != -1 || tmpStr.indexOf("-") != -1) {
// We know we have a negative number, so place '$' inside of '(' / after '-'
if (tmpStr.charAt(0) == "(")
tmpStr = "($" + tmpStr.substring(1,tmpStr.length);
else if (tmpStr.charAt(0) == "-")
tmpStr = "-$" + tmpStr.substring(1,tmpStr.length);
return tmpStr;
}
else
return "$" + tmpStr; // Return formatted string!
}
See also:
| file: /Techref/language/asp/js/formatCurrency.htm, 1KB, , updated: 2008/2/1 07:13, local time: 2012/2/10 10:17,
38.107.179.234:LOG IN |
| ©2012 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://www.piclist.com/techref/language/asp/js/formatCurrency.htm"> language asp js formatCurrency</A> |
| Did you find what you needed? |
|
o List host: MIT, Site host massmind.org, Top posters @20120210 Electron, V G, IVP, RussellMc, Carl Denk, Isaac Marino Bavaresco, YES NOPE9, William \Chops\ Westfield, cdb, alan.b.pearce, * Page Editors: James Newton, David Cary, and YOU! * Roman Black of Black Robotics donates from sales of Linistep stepper controller kits. * Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters. * Monthly Subscribers: None at this time. on-going support is MOST appreciated! * Contributors: Richard Seriani, Sr. |
|
Ashley Roll has put together a really nice little unit here. Leave off the MAX232 and keep these handy for the few times you need true RS232! |
.