This content has been marked as final. Show 10 replies
where s1 and s2 are doublePrimitive types, including double, haven't method toString().
Primitive types, including double, haven't methodYes they do.. :)
No idea what could be the problem though with the code though...
Yes they do..Don't mix up primitive type double with class Double which of course has toString().
Don't mix up primitive type double with classOh, sorry, my mistake.. Thanks for pointing that out..
Double which of course has toString().
So how can I convert String to double?
I'd say.. :s
import java.util.*; ....... Double.parseDouble(string_to_make_double);
double all =
double all = s1 + s2; // since you say both are double.
where s1 and s2 are double with comma and all addingWhat do you mean by double with comma? doubles don't have comma.
import java.util.*;Not needed for parsing a String to double.
So you're saying that your formatter uses commas for decimal places, since that's the standard of your country, but you want to use periods instead. I don't see a simple way to change the decimal separator, but you can specify the Locale used to format the numbers. Look at the NumberFormat class' getInstance(Locale) method. You should be able to set the Locale to say the US and get the right format.
In my country we don't use points, we use comma to separete number in double, so if I want to export those data to cvs (excel file) i need commas, not point that why i replace comma to point