localization - (android) decimalformat, uses comma in place of fullstop while formatting with "#.##" -
i developing android app want format double number #.##, have done using below code.
double bmi = ((fweight)/(dheight*dheight)); decimalformat df = new decimalformat("0.00"); string sbmi = df.format(bmi);
while testing when language of hardware set english(default language), works fine, example if bmi 2497.227216676656 , formats sbmi 2497.23 , if language selected french formats 2497,23. in place of dot, comma being used crashing app!!!
what reason this?
try this:
double bmi = ((fweight)/(dheight*dheight)); decimalformat df = new decimalformat("0.00"); decimalformatsymbols dfs = new decimalformatsymbols(); dfs.setdecimalseparator('.'); df.setdecimalformatsymbols(dfs); string sbmi = df.format(bmi);
Comments
Post a Comment