public static SuperDouble ReadSD(StringBuilder line, ref int pos) { int cp; for (cp = pos; cp < line.Length; cp++) { if (!char.IsDigit(line[cp])) { break; } } if (cp != line.Length) { if (line[cp] == 'E' | line[cp] == 'e') { cp++; } for (; cp < line.Length; cp++) { if (!char.IsDigit(line[cp])) { break; } } } string sl = line.ToString(pos, cp - pos); SuperDouble sd = SuperDouble.Parse(sl); pos = cp; return(sd); }
static bool TryReadNumber(StringBuilder line, ref int pos, out SuperDouble val) { if (pos >= line.Length) { val = default(SuperDouble); return(false); } if (!char.IsDigit(line[pos])) { val = default(SuperDouble); return(false); } SuperDouble sd = ReadSD(line, ref pos); val = sd; return(true); }