About how to convert with a thousand-manifer floating point nutrient string into a Double type

xiaoxiao2021-03-06  15

In the programming, it is usually encountered with a small problem that converts the multi-man floating point nutrient string into a Double type. The following example shows:

Import java.text. *; ... try {string S1 = "1,000.00"; string S2 = "100.00";

Double D1 = new decimalformat (). Parse (S1) .doublevalue (); double d2 = new decimalformat (). Parse (s2) .doublevalue (); system.out.println (d1); system.out.println (d2 ); (ParseException PE) {system.out.println (pe.getMessage ()); pe.printstacktrace ();

The output is: 1000.00100.00

Ha ha ~~ This is what I want.

转载请注明原文地址:https://www.9cbs.com/read-48572.html

New Post(0)