config: trim spaces and tabs

This commit is contained in:
Peter Cai
2017-08-23 10:38:55 +08:00
parent 57b874ee6d
commit 6ef38709a6
3 changed files with 22 additions and 2 deletions

View File

@@ -607,3 +607,14 @@ int run_command_no_log(string command0,char * &output) {
return 0;
}*/
// Remove preceding and trailing characters
string trim(const string& str, char c) {
size_t first = str.find_first_not_of(c);
if(string::npos==first)
{
return "";
}
size_t last = str.find_last_not_of(c);
return str.substr(first,(last-first+1));
}