Insert commas in a number for formatting

Posted by gameover on Stack Overflow See other posts from Stack Overflow or by gameover
Published on 2010-03-13T03:42:31Z Indexed on 2010/03/13 3:47 UTC
Read the original article Hit count: 214

Filed under:
|
|

I need a way to convert a number into formatted way by inserting comma at suitable places. Can it be done using regex?

Example:

12345 => 12,345
1234567 =>1,234,567

© Stack Overflow or respective owner

Related posts about regex

Related posts about php