#include "CustomStringUtilities.h" #include const char* CustomStringUtilities::typeOfWhitespacesReturn = " \t\n\r\f\v"; const char* CustomStringUtilities::typeOfWhitespaces = " \t\r\f\v"; void CustomStringUtilities::removeAllWhitespaces(std::string& str, bool trimReturn) { const char* whitespaces = trimReturn ? typeOfWhitespacesReturn : typeOfWhitespaces; size_t pos, offset = 0; while ((pos = str.find_first_of(whitespaces, offset)) != std::string::npos) { str.erase(pos, 1); offset = pos; } } void CustomStringUtilities::trim(std::string& str) { str.erase(str.find_last_not_of(typeOfWhitespaces) + 1); str.erase(0, str.find_first_not_of(typeOfWhitespaces)); }