On Tue, Aug 05, 2003 at 11:55:12PM +0900, Chris Morris wrote:
> I'm brain dead and just trying to get formatted numbers in a task that's 
> already 10 tangents deep -- argh. Anyway, how can I sprintf (or 
> otherwise) this:
> 
>  456778904
> 
> to this:
> 
>  456,778,904

Unless there's something I don't know about - a distinct possibility
- there's no built-in function to do this.  You can, however,
do it with a regex.  Assuming the numbers are all integers (no
decimal points), then this will work:

	formatted_n = n.to_s.reverse.gsub(/...(?=.)/,'\&,').reverse

-Mark