Wild Plague Wild Plague - 1 year ago 98
Android Question

How to remove decimal point from a double value after converting it to astring

I want to remove a decimal point from a

value. I tried by converting it to string

double intify(double a)
String s=Double.toString(a);
String s2=s.replaceAll(".","");

return a;


If I pass 123.4567 it should return 1234567.

Answer Source

replaceAll replaces a regex. You should use replace instead:

String s2 = s.replace(".","");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download