// Copyright (C) 2010, Guy Barrand. All rights reserved. // See the file tools.license for terms. #ifndef tools_sbeg #define tools_sbeg #include namespace tools { inline bool is_beg(const std::string& a_s,const std::string& a_b,bool a_forward = true){ //look if a_s begin with a_b. std::string::size_type ls = a_s.size(); std::string::size_type lb = a_b.size(); if(lb>ls) return false; if(!lb) return false; if(a_forward) { const char* ps = a_s.c_str(); const char* pb = a_b.c_str(); for(std::string::size_type index=0;index= a_b.size()+1 : a_cmd = a_s.substr(a_b.size()+1,a_s.size()-(a_b.size()+1)); return true; } } #endif