Number's Group separator and Decimal separator according to local regional format:
/** @ Returns the number's Group separator according to local regional format */
/** @ Returns the number Decimal separator according to local regional format */
ie convert the number
/** @ Returns the number's Group separator according to local regional format */
/** @ Returns the number's Group separator according to local regional format */
protected String getGroupSeparator() {
DecimalFormat decFormat = new DecimalFormat();
DecimalFormatSymbols decSymbols = decFormat.getDecimalFormatSymbols();
return String.valueOf(decSymbols.getGroupingSeparator());
}
/** @ Returns the number Decimal separator according to local regional format */
/** @ Returns the number Decimal separator according to local regional format */
protected String getDecimalSeparator() {
DecimalFormat decFormat = new DecimalFormat();
DecimalFormatSymbols decSymbols = decFormat.getDecimalFormatSymbols();
return String.valueOf(decSymbols.getDecimalSeparator());
}
Number with group-separator and decimal-separator convert into decimal number
ie convert the number
"4,471.26"
into decimal number "4471.26"
dis-respective the number format is (for example it could be
4,294,967,295.00 or 4.294.967.295,000 )public static void geoSp() {
String a = "4.233,19";
NumberFormat as = NumberFormat.getInstance();
double myNumber = 0;
try {
myNumber = as.parse(a).doubleValue();
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println(String.valueOf(myNumber));
}
gives Out put :- 4233.19
No comments:
Post a Comment