Commatizing numbers: Difference between revisions

Content added Content deleted
(→‎{{header|Factor}}: change word names, more descriptive stack effects, use existing "replace" word)
m (→‎{{header|Factor}}: missed one)
Line 319: Line 319:
[ cut dup numeric dup ] 2dip commas replace append ;
[ cut dup numeric dup ] 2dip commas replace append ;


: commatize* ( text from period sep -- str )
: commatize* ( text from period separator -- str )
reach [ digit? ] any? [ (commatize) ] [ 3drop ] if ;
reach [ digit? ] any? [ (commatize) ] [ 3drop ] if ;