There's a printf format to do this ("%'d"), but apparently depends on LOCALE setting probably not good to use.