/// <summary> /// 科学计数法值转换成正常值 /// </summary> /// <param name="value"></param> /// <returns></returns> public string ValueScientificNotationConvert(JToken value) { if (value == null) return ""; var s = value.ToString(Formatting.Indented).ToString(); string num = String.Empty; // s = s.Trim(); string[] arr = s.Split(‘E‘); int LastZeroCountInPart1 = 0; foreach (char ch in arr[0].Reverse()) { if (ch == ‘0‘) LastZeroCountInPart1++; else { break; } } bool isPart1Double = double.TryParse(arr[0], out var part1); int decimalDigitCountInPart1 = arr[0].IndexOf(‘.‘) == -1 ? 0 : arr[0].Length - 1 - arr[0].IndexOf(‘.‘); string newPart2 = arr.ElementAtOrDefault(1); bool isPart2Int = int.TryParse(newPart2, out var part2); if (arr.Length == 1) { if (isPart1Double) num = part1.ToString(); } if (arr.Length == 2) { if (part2 < 0 || part2 - decimalDigitCountInPart1 < 0) { if (isPart1Double && isPart2Int) num = Decimal.Parse((part1 * Math.Pow(10, part2)).ToString(), System.Globalization.NumberStyles.Float).ToString(); // 此时Math.Pow(10, part2)并不会越界,故可使用Decimal.Parse从scientific num转换为real num } else if (part2 - decimalDigitCountInPart1 >= 0) { num = part1.ToString().Replace(".", "") + new String(‘0‘, part2 - decimalDigitCountInPart1); // 避免越界,此处使用字符串拼接代替Math.Pow(10, part2),拼接还可用StringBuilder的append方法 } } return num + new String(‘0‘, LastZeroCountInPart1); // 此处拼接还可使用StringBuilder的append方法 }