Re: C#中,如何将字符串转化为double/float.# EE - 电子工程
c*s
1 楼
首先,感谢你的贴子.
我实验了你提供的方法,但是系统给出了下面的错误信息:
An unhandled exception of type 'System.FormatException' occurred in
mscorlib.dll
Additional information: Input string was not in a correct format.
我是这样转化得到的字符串数组的.
char x_char [20]; %已经得到
string x_str=x_char.toString();
%虽然成功,但是检查内存,发现x_str是一个System.char[],并不是相象的string;
double xx=Convert.TODouble(x_str);%系统报错在这里
我实验了你提供的方法,但是系统给出了下面的错误信息:
An unhandled exception of type 'System.FormatException' occurred in
mscorlib.dll
Additional information: Input string was not in a correct format.
我是这样转化得到的字符串数组的.
char x_char [20]; %已经得到
string x_str=x_char.toString();
%虽然成功,但是检查内存,发现x_str是一个System.char[],并不是相象的string;
double xx=Convert.TODouble(x_str);%系统报错在这里