// Copyright (C) 2010, Guy Barrand. All rights reserved. // See the file tools.license for terms. #ifndef tools_strip #define tools_strip #include #include namespace tools { enum what { leading, trailing, both }; inline bool strip(std::string& a_string,what a_type = both,char a_char = ' '){ //return true = some stripping had been done. std::string::size_type l = a_string.length(); if(l==0) return false; switch ( a_type ) { case leading:{ char* pos = (char*)a_string.c_str(); for(std::string::size_type i=0;i& a_strings,what a_type = both,char a_char = ' ') { bool some_done = false; std::vector::iterator it; for(it=a_strings.begin();it!=a_strings.end();++it) { if(strip(*it,a_type,a_char)) some_done = true; } return some_done; } } #endif