There are no implementations yet, just a rough outline and some comments. This commit also includes an update to the Makefile to use wild cards to build the `libs`, which will solve the issue with dynamic updating.
25 lines
547 B
C++
25 lines
547 B
C++
#include "./util.h"
|
|
|
|
void removeTrailingWhitespace(std::string &input) {
|
|
size_t start = input.find_first_not_of(" \t\n\r\f\v");
|
|
if (start != std::string::npos) {
|
|
input.erase(0, start);
|
|
} else {
|
|
input.clear();
|
|
}
|
|
}
|
|
|
|
void removeLeadingWhitespace(std::string &input) {
|
|
size_t end = input.find_last_not_of(" \t\n\r\f\v");
|
|
if (end != std::string::npos) {
|
|
input.erase(end + 1);
|
|
} else {
|
|
input.clear();
|
|
}
|
|
}
|
|
|
|
void removeWhitespace(std::string &input) {
|
|
removeLeadingWhitespace(input);
|
|
removeTrailingWhitespace(input);
|
|
}
|