What: commas added to numbers
Where: From the contact Description: Tiny Tcl regsub comma to add commas to numbers, taking leading white space, - or +, and decimal points into account. Updated: Contact: mailto:[email protected] (John Allen)
In Bag of algorithms there's a one-liner alternative by Peter Spjuth (in the Tcl chatroom, 2004-10-05) using modern regexp features:
proc commify number {regsub -all {\d(?=(\d{3})+($|\.))} $number {\0,}}