diff --git a/vutility.cpp b/vutility.cpp index 2769252..bdb4f1b 100644 --- a/vutility.cpp +++ b/vutility.cpp @@ -14,14 +14,12 @@ std::vector vutility::split(std::string str, char delimit) std::string vutility::trim(std::string str) { - if (str.substr(0, 2) == "//") + if (str.find('/') != std::string::npos) // comments { - str.erase(); - } - else - { - str.erase(0, str.find_first_not_of(" \r\t\v\n")); //prefixing - str.erase(str.find_last_not_of(" \r\t\v\n") + 1); //surfixing} + str.erase(str.find('/')); } + str.erase(0, str.find_first_not_of(" \r\t\v\n")); //prefixing + str.erase(str.find_last_not_of(" \r\t\v\n") + 1); //surfixing} + return str; } \ No newline at end of file