我想这个字符串转换: 0.55000000000000004
来这双: 0.55
。
那怎么办?
I want to convert this string: 0.55000000000000004
to this double: 0.55
.
How to do that?
是一个字符串或双? 如果它是一个字符串:
Is a string or a double? If it is a string:
double d = double.Parse(s,CultureInfo.InvariantCulture);
string s=string.Format("{0:0.00}",d);
,如果它已经使用第二线的双重只是格式
if it is already a double just format using the second line.