This
annoyed me for a good
twenty minutes today, so I thought I'd
share it...
(This comma-delimits a given number, e.g "12345" becomes "12,345", "1234567" becomes "1,234,567" and so on.)
Tcl:
while {[regsub {^([^,]+)([0-9][0-9][0-9])} $num {\1,\2} num]} {}
PHP:
$a = $b = (string) $num;
while (($b = ereg_replace('^([^,]+)([0-9]{3})', '\1,\2', $a)) && $b != $a) $a = $b;
$num = (string) $a;
P.S.: It was an absolute
bitch putting those square brackets in without
Everything making it a
link. I did it with "[" and "]", for '[' and ']', respectively.