35 public static IReadOnlyDictionary<int, double>
ParseLines(
36 IEnumerable<string> lines)
38 ArgumentNullException.ThrowIfNull(lines);
41 new Dictionary<int, double>();
43 foreach (
string line
in lines)
45 if (
string.IsNullOrWhiteSpace(line))
51 VariableNameRegex().Match(line);
55 match.Groups[1].Value,
57 CultureInfo.InvariantCulture,
64 line[(match.Index + match.Length)..];
67 NumberRegex().Match(suffix);
69 if (!numberMatch.Success ||
73 CultureInfo.InvariantCulture,
75 !
double.IsFinite(value))
103 if (
string.IsNullOrWhiteSpace(text) ||
104 string.IsNullOrWhiteSpace(prefixPattern))
113 @"\s*(?<value>[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)",
114 RegexOptions.IgnoreCase |
115 RegexOptions.CultureInvariant);
117 return match.Success &&
119 match.Groups[
"value"].Value,
121 CultureInfo.InvariantCulture,
123 double.IsFinite(value);