java - Best way to parseDouble with comma as decimal separator? -


following resulting in exception:

string p="1,234"; double d=double.valueof(p);  system.out.println(d); 

is there better way parse "1,234" 1.234 than: p = p.replaceall(",",".");?

use java.text.numberformat:

    numberformat format = numberformat.getinstance(locale.france);     number number = format.parse("1,234");     double d = number.doublevalue(); 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -