The implementation is inspired by Poco Library
std::string trim(std::string input) { int first = 0; int last = input.size() - 1; while (first <= last && isspace(input[first])) { first++; } while (last >= first && isspace(input[last])) { last--; } return input.substr(first, (last - first + 1)); }
No comments:
Post a Comment