FormatNumber.commands = {
copy: 1,
color: 2,
integer_placeholder: 3,
fraction_placeholder: 4,
decimal: 5,
currency: 6,
general: 7,
separator: 8,
date: 9,
comparison: 10,
section: 11,
style: 12
};
FormatNumber.formatNumberWithFormat = function(
rawvalue,
format_string,
currency_char
) {
var scfn = FormatNumber;
var op, operandstr, fromend, cval, operandstrlc;
var startval, estartval;
var hrs, mins, secs, ehrs, emins, esecs, ampmstr, ymd;
var minOK, mpos, mspos;
var result = "";
var format;
var section, gotcomparison, compop, compval, cpos, oppos;
var sectioninfo;
var i,
decimalscale,
scaledvalue,
strvalue,
strparts,
integervalue,
fractionvalue;
var integerdigits2,
integerpos,
fractionpos,
textcolor,
textstyle,
separatorchar,
decimalchar;
var value;
rawvalue = rawvalue - 0;
value = rawvalue;
if (!isFinite(value)) return "NaN";
var negativevalue = value < 0 ? 1 : 0;
if (negativevalue) value = -value;
var zerovalue = value == 0 ? 1 : 0;
currency_char = currency_char || DefaultCurrency;
FormatNumber.parse_format_string(scfn.format_definitions, format_string);
format = scfn.format_definitions[format_string];
if (!format) throw "Format not parsed error.";
section = format.sectioninfo.length - 1;