// 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