C# how to convert a double to string with exponential notation

后端 未结 1 1971
小鲜肉
小鲜肉 2021-01-29 08:31

I\'m trying to convert double to string in format of exponential notation. for example:

double l_dNum = 3.333;
        string l_strNum = l_dNum.ToString();
             


        
相关标签:
1条回答
  • 2021-01-29 08:54

    From MSDN examples

    string l_strNum = l_dNum.ToString("E");
    

    If you want up to 2 decimals only

    string l_strNum = l_dNum.ToString("E2");
    
    0 讨论(0)
提交回复
热议问题