Convert numbers with exponential notation from string to double or decimal

后端 未结 4 850
栀梦
栀梦 2020-12-11 01:28

Is there a fast way to convert numbers with exponential notation (examples: \"0.5e10\" or \"-5e20\") to decimal or double?

Update: I found Parse a N

4条回答
  •  余生分开走
    2020-12-11 01:53

    @Noldorin is correct try this code:

    string str = "-5e20";
    double d = double.Parse(str);
    Console.WriteLine(str);
    

提交回复
热议问题