// 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 void strip(std::string& a_string,what a_type = both,char a_char = ' '){ std::string::size_type l = a_string.length(); if(l==0) return; switch ( a_type ) { case leading:{ std::string::size_type i; char* pos = (char*)a_string.c_str(); for(i=0;i& a_strings,what a_type = both,char a_char = ' ') { std::vector::iterator it; for(it=a_strings.begin();it!=a_strings.end();++it) { strip(*it,a_type,a_char); } } } #endif