3.2.0

Number formatting

I wanted to use:

var cy = new Active.Formats.Number;
var tm = new Active.Formats.Number;
var sz = new Active.Formats.Number;
cy.setTextFormat("$ #,###.##");
tm.setTextFormat("# Min");
sz.setTextFormat("# MB");

but the result was not what I expected. Line 73 of source/lib/formats/number.js is:

var pattern =
/^([^0#]*)([0#]*)([ .,]?)([0#]|[0#]{3})([.,])([0#]*)([^0#]*)$/;

Making the second [.,] optional, as in:

var pattern =
/^([^0#]*)([0#]*)([ .,]?)([0#]|[0#]{3})([.,]?)([0#]*)([^0#]*)$/;

allows the above to work. Is there a downside to this change that I'm overlooking, or a better method?

Scott R. Keszler
April 19,

This topic is archived.

See also:


Back to support forum