The string is processed using the
Method One:
String str = "1,000";
str = str. Replace (",", "");
Method Two:
String str = "100,000,000";
String str1 = "";
string[] A = str. Split (', ');
for (int i = 0; I <= a.length-1; i++) {
STR1 + = A[i];
}
Method Three:
Using DecimalFormat
Implement formatting in the format you want please look down--------------------------decimalformat usage
DecimalFormat is a specific subclass of NumberFormat that is used to format decimal digits.
DecimalFormat contains a pattern and a set of symbols
Symbolic Meaning:
01 digits
# A number, excluding 0 ,
. Placeholder for separator of decimal,
, placeholder for grouping delimiters
, separating the formatting. &NBSP
-default negative number prefix. &NBSP
% multiplied by 100 and displayed as a percentage
multiplied by 1000 and displayed as a thousand currency symbol, replaced by currency notation, and replaced with a
International currency symbol if double write. If it appears in a pattern, the is replaced with the currency decimal separator, and the
is the decimal separator. Any other character used in the
X prefix or suffix to refer to the special characters in the prefix or suffix. &NBSP
Example:
DecimalFormat df1 = new DecimalFormat ("0.0");
DecimalFormat df2 = new Deci Malformat ("#.#");
DecimalFormat df3 = new DecimalFormat ("000.000");
DecimalFormat df4 = new DecimalFormat ("###.###");
System.out.println (Df1.format (12.34));
System.out.println ( Df2.format (12.34));
System.out.println (Df3.format (12.34));
System.out.println ( Df4.format (12.34));
Result:
12.3
12.3
012.340
12.34