Is there any way to split a double number in java so that all groups of 3 digits are splitted with a space and only 2 digits after a comma are appeared? It’s easy to separate them with a comma:
DecimalFormat df = new DecimalFormat("###,###.00");
df.format(number);
So that 235235.234 turns into 234,234.23
What I need is 234 234.23
How can I do that?
I believe the comma in your format string isn’t really a comma – it’s just the grouping symbol in the
DecimalFormatSymbolsyou’re using.Try this:
Or as an alternative for the last line: