Tanmay kumar shaw
Tanmay kumar shaw

Reputation: 219

how to format a number into comma separated using css

I have these numbers 10010999.00 and 8094.456 and 456.78

And all I want to do is add a comma in the right place if it needs it so it looks like this 10,010,999.00 and 8,094.45 and 456.78 in the JSP page.

Upvotes: 2

Views: 5723

Answers (2)

Ryan McDonough
Ryan McDonough

Reputation: 10012

Short answer: You can't. It was proposed in 2008 as Content Data Function addition to CSS3, however nothing came of it. You will need to perform this action in Javascript.

There is a suggestion on how to format numbers in JS in this answer: Format numbers in javascript

Upvotes: 1

hamed
hamed

Reputation: 8033

You can do this via toLocaleString() function.

Upvotes: 2

Related Questions