Category talk:Wren-fmt: Difference between revisions
Content added Content deleted
(→Source code: Bug fix plus new method group.) |
(→Source code: Minor bug fix.) |
||
Line 164: | Line 164: | ||
// Adds 'thousand separators' to a decimal integer or string. |
// Adds 'thousand separators' to a decimal integer or string. |
||
static commatize(n, c) { |
static commatize(n, c) { |
||
if (!(n is Num && n.isInteger) && ! |
if (!(n is Num && n.isInteger) && !isDecimal_(n)) Fiber.abort("Argument is not a decimal integer nor string.") |
||
if (!(c is String) || c.count != 1) Fiber.abort("Separator must be a single character string.") |
if (!(c is String) || c.count != 1) Fiber.abort("Separator must be a single character string.") |
||
if (n is Num) n = "%(Conv.dec(n))" |
if (n is Num) n = "%(Conv.dec(n))" |