Skip to content

Commit 9c7b44a

Browse files
Fix precision parsing in string_format
The 4th group in the regular expression matches `(\.\d+)?` so the dot should be ignored before the string can be parsed to an int.
1 parent df5144d commit 9c7b44a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: src/solvers/strings/string_constraint_generator_format.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ static format_specifiert format_specifier_of_match(std::smatch &m)
198198
int index = m[1].str().empty() ? -1 : std::stoi(m[1].str());
199199
std::string flag = m[2].str();
200200
int width = m[3].str().empty() ? -1 : std::stoi(m[3].str());
201-
int precision = m[4].str().empty() ? -1 : std::stoi(m[4].str());
201+
int precision = m[4].str().empty() ? -1 : std::stoi(m[4].str().substr(1));
202202
std::string tT = m[5].str();
203203

204204
bool dt = !tT.empty();

0 commit comments

Comments
 (0)