RawSushi's Tech Journal
My online tech scrapbook where I keep my notes in case I need to look them up later
Tuesday, September 30, 2014
Java Number Formatting with Comma Separators
Use the DecimalFormat class e.g.:
DecimalFormat f = new DecimalFormat("#,###.##.00");
String str = f.format(12345.67);
References:
http://stackoverflow.com/questions/3672731/how-can-i-format-a-string-number-to-have-commas-and-round
http://docs.oracle.com/javase/tutorial/java/data/numberformat.html
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment