Skip to content

Commit 9add365

Browse files
preghenellasawenzel
authored andcommitted
ConfigurableParam: allow spaces in configuration list
1 parent dd734f5 commit 9add365

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Common/SimConfig/src/ConfigurableParam.cxx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,14 @@ void ConfigurableParam::updateFromString(std::string configstring)
140140
std::string extractedvalue;
141141
int counter = 0;
142142
// TODO: make sure format is correct with a regular expression
143-
for (const auto& s : keyvaluetokenizer) {
143+
for (const auto& ss : keyvaluetokenizer) {
144+
auto s = ss;
145+
if (s.front() != s.back() || (s.front() != '\'' && s.front() == '\"')) { // not a string
146+
s.erase(std::remove(s.begin(), s.end(), ' '), s.end()); // remove all spaces
147+
} else { // a string
148+
s.erase(0, s.find_first_not_of(' ')); // remove leading spaces
149+
s.erase(s.find_last_not_of(' ') + 1); // remove trailing spaces
150+
}
144151
if (counter == 1) {
145152
extractedvalue = s;
146153
}

0 commit comments

Comments
 (0)