本文介绍了转换成数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class converstion
{

    public static void Main(string[] args)
{
string s1="sidd";
string s2="siddh";



double da=Convert.ToDouble(s1);
double d=Convert.ToDouble(s2);
Console.WriteLine("converte string is={0}",da);
Console.WriteLine("converte string is={1}", d);

}

}


它会成功编译但无法运行...错误未处理的Exceptuon:System.FormatException:输入字符串不在正确的formate中.


it compile successfullly but not run...error "Unhandel Exceptuon:System.FormatException:input string was not in a correct formate

推荐答案



String str="50";
double doubleValue=Convert.ToDouble(str);



现在它将使您返回双值....

关于Rahul



and now it will return you to a double value....

Regards Rahul


这篇关于转换成数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 14:38