Commit fca2c63ebcc3b63c07a9cd08a2921ee55420cc66
1 parent
531b9229
strip any leading or trailing whitespace from input string
Showing
1 changed file
with
4 additions
and
3 deletions
src/app/GPar.cpp
| @@ -203,7 +203,7 @@ void GPar::mode(const std::string& mode) | @@ -203,7 +203,7 @@ void GPar::mode(const std::string& mode) | ||
| 203 | ***************************************************************************/ | 203 | ***************************************************************************/ |
| 204 | void GPar::value(const std::string& value) | 204 | void GPar::value(const std::string& value) |
| 205 | { | 205 | { |
| 206 | - // Verify that valie is valid | 206 | + // Verify that value is valid |
| 207 | check_value(value); | 207 | check_value(value); |
| 208 | 208 | ||
| 209 | // Set mode | 209 | // Set mode |
| @@ -580,8 +580,6 @@ void GPar::check_value_filename(const std::string& value) const | @@ -580,8 +580,6 @@ void GPar::check_value_filename(const std::string& value) const | ||
| 580 | * | 580 | * |
| 581 | * This method queries the parameter from the stardard input if it is needed | 581 | * This method queries the parameter from the stardard input if it is needed |
| 582 | * to be input by the user. | 582 | * to be input by the user. |
| 583 | - * | ||
| 584 | - * @todo Optional use of readline library | ||
| 585 | ***************************************************************************/ | 583 | ***************************************************************************/ |
| 586 | void GPar::query(void) | 584 | void GPar::query(void) |
| 587 | { | 585 | { |
| @@ -613,6 +611,9 @@ void GPar::query(void) | @@ -613,6 +611,9 @@ void GPar::query(void) | ||
| 613 | std::string value = std::string(line); | 611 | std::string value = std::string(line); |
| 614 | #endif | 612 | #endif |
| 615 | 613 | ||
| 614 | + // Strip any whitespace from string | ||
| 615 | + value = strip_whitespace(value); | ||
| 616 | + | ||
| 616 | // Update value if value is not the default | 617 | // Update value if value is not the default |
| 617 | if (value.length() > 0) { | 618 | if (value.length() > 0) { |
| 618 | m_value = value; | 619 | m_value = value; |