e dot dot dot
home << Programming << Javascript << auto number formatting

Tue, 13 May 2008

Number Formatting
These two functions clean up and format numbers quite nicely. One function takes any decimal number, negative or positive, and formats it by adding commas every three digits. The other function strips any non-numeric characters from a string leaving you with a valid decimal number. It considers the minus sign and the period to be numeric and will not strip them unless the minus sign is not at the beginning of the number or there is more than one period. These functions make use of regular expressions to do the heavy lifting.

Read more here


edit: Programming/Javascript/auto___number_formatting.wikieditish...

Password:
Title:
Body:
Link | Image | Paragraph | BR | Return | Create Amazon link | Technorati tag
Technorati tag?:
Delete this item?:
Treat as new?:
home << Programming << Javascript << auto number formatting