C implements the conversion of scientific counting (E) into normal numeric values

  • 2021-06-28 13:41:20
  • OfStack

1. String values contain scientific counts such as E, such as 12E-2, which need to be converted to a normal value of 0.12.

2. The transformation function is as follows:


 private Decimal ChangeDataToD(string strData)
        {
            Decimal dData = 0.0M;
            if (strData.Contains("E"))
            {
                dData = Convert.ToDecimal(Decimal.Parse(strData.ToString(), System.Globalization.NumberStyles.Float));
            }
            return dData;
        }

3. Call ChangeDataD directly when called (strText)

4.12 after running.


Related articles: