FIxing decimal places during string conversion in Java -
I have some text that has both wires and numbers.
I parse the input and count some with numbers.
I get the string to / code> string in which all the lines of the text and the count of the numbers are included, I just click Now when I add a string to Is there any way to do this? In the future, if such a person has such a question, / p> Here the specifier is for two decimal places. System.out.println (" S ", appended_string) .
StringBuilder is converted from a
double , I want it to have specific decimal numbers, so that when I finally print the whole thing, then print it with the specified number of digits.
string Formatted string; FormattedString = String.format ("% .2f", number);
Comments
Post a Comment