Convert number to comma separated number Given a number, say, -2982342342363.23425785 convert it to -2,982,342,342,363.23425785.


Extra points for not using look-behind
Extra points for not using regular expressions.
Java, 50 chars

String C(double d){return String.format("%,f",d);}


Works as specified in most locales.  Does the correct thing in all locales :)

Edit:

If you really want commas no matter the default locale, do:

String C(double d){return String.format(java.util.Locale.US,"%,f",d);}


which is 70 characters (60 if you've already imported java.util.*).