Long story short here is my code that throws the number format exception:-
String percenta = "6.415";
holder.setPercent(Double.parseDouble(percenta));
I've tried a also Double.valueOf() but none of them work, still throws the same exception
here is the exception message
java.lang.NumberFormatException: For input string: "6.415"
what seems to be the problem here ?
EDIT
so the problem is in my encoding after all, how do i change that, I am using JSOUP to parse a page and it is supposed to be UTF-8, is Double.parseDouble not UTF-8 friendly ?
Try using:
NumberFormat format = NumberFormat.getInstance(Locale.US);
Number number = format.parse("6.415");
double d = number.doubleValue();
This may happen because of your internal Locale specification.
In order to verify it, check if it works:
String percenta = "6,415";
holder.setPercent(Double.parseDouble(percenta));