Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (10.2k points)

How can I use String.format(format String,X) to format a double like follows???

2354548.235 -> 2,354,548.23

Thanks!

1 Answer

0 votes
by (46k points)

String.format("%1$,.2f", myDouble);

String.format automatically uses the default locale.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Oct 17, 2019 in Java by Shubham (3.9k points)
0 votes
0 answers
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...