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:allen@gdstech.grumman.com (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,}} ---- Comment: commify only works for numbers with less than 3 digits after decimal point e.g. () 4 % commify 1234567.123456 1,234,567.123,456 ---- [[ [Category Package] | [Category Mathematics] ]]