Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse model values of the form 5e1 (no decimal) #861

Merged
merged 4 commits into from
Apr 11, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Source/Model/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,6 @@ Element ConstructElement(string name)
}

var allDigits = new Regex(@"^-?[0-9]*$");
var real = new Regex(@"^-?[0-9]+\.[0-9]+$");
if (allDigits.IsMatch(name))
{
if (szi > 0)
Expand All @@ -711,7 +710,7 @@ Element ConstructElement(string name)
return new Integer(this, name);
}
}
else if (real.IsMatch(name))
else if (double.TryParse(name, out var _))
{
return new Real(this, name);
}
Expand Down Expand Up @@ -1077,4 +1076,4 @@ public static List<Model> ParseModels(System.IO.TextReader rd, Func<string, stri
return p.resModels;
}
}
}
}
Loading