正则表达式:
@"([+-]?)([^0]\d\.\d{1,})E([-]?)(\d+)"
将文本中的 所有科学计数法的部分 转化为 非科学计数法方式
例如:
1.78813934E-07 ->
-1.78813934E-02 ->
public static string convert_e_to_double_more(string text)
{
Regex reg = new Regex(@"([+-]?)([^0]\d\.\d{1,})E([-]?)(\d+)", RegexOptions.IgnoreCase);
string text_new = text;
MatchCollection mac = reg.Matches(text_new);
foreach (Match m in mac)
{
//string v00 = m.Groups["ss"].ToString();
string v0 = m.Groups[0].Value;
// 转化为非科学计数法
decimal vv = Convert.ToDecimal(Convert.ToDouble(v0)); // 格式转换为非科学计数法 0.00000000
//string vv0 = vv.ToString();
text_new = text_new.Replace(v0, vv.ToString());
}
//MessageBox
return text_new;
}
n