I wrote the following c++ code which removes spaces from beginning and end of a string, But the problem with it is that it doesn't remove tabs, how may I fix that?
Plus, is there anything similar to tabs and spaces? (I am reading lines from file)
string trim_edges(string command) {
const auto command_begin = command.find_first_not_of(' ');
if (command_begin == std::string::npos)
return "";
const auto strEnd = command.find_last_not_of(' ');
const auto strRange = strEnd - command_begin + 1;
return command.substr(command_begin, strRange);
}