Well, it looks like we have this more or less exact word in ``tools.memory:commas``, and something very close in ``money:format-money``.,On Fri, Jun 16, 2017 at 4:38 PM, Alexander Ilin <ajs...@yandex.ru> wrote:Hello!Wow, this is way more general than what I came up with:```: num>grouped-str ( n -- str )number>string <reversed> 3 <groups> "," join reverse ;```Maybe your code should be included in the prettyprinter or somewhere similar, next to `number>string`, perhaps?17.06.2017, 02:33, "John Benediktsson" <mrj...@gmail.com>:,Note: that word doesn't work properly for negative numbers. This is better:: number>string-with-commas ( str -- str' )[abs number>string "." split1[ reverse 3 <groups> "," join reverse ] dip[ "." glue ] when*] [ neg? [ "-" prepend ] when ] bi ;On Fri, Jun 16, 2017 at 4:29 PM, John Benediktsson <mrj...@gmail.com> wrote:We don't have that kind of locale support right now, but you could use something like:: number>string-with-commas ( str -- str' )number>string "." split1[ reverse 3 <groups> "," join reverse ] dip[ "." glue ] when* ;On Fri, Jun 16, 2017 at 4:18 PM, Alexander Ilin <ajs...@yandex.ru> wrote:Hello!
Is there a standard way to output a number with comma separators grouping the thousands?
```
1,000,000 num>str-grouped
"1,000,000"
```
---=====---
Александр
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk------------------------------------------------------------------------------
,
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk---=====---Александр
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk
------------------------------------------------------------------------------
,
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk