Warning, /include/Geant4/tools/schar is written in an unsupported language. File is not indexed.
0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003
0004 #ifndef tools_schar
0005 #define tools_schar
0006
0007 #include <string>
0008
0009 namespace tools {
0010
0011 inline bool belong(const std::string& a_string,char a_c){
0012 std::string::const_iterator it;
0013 for(it=a_string.begin();it!=a_string.end();++it) {
0014 if((*it)==a_c) return true;
0015 }
0016 return false;
0017 }
0018
0019 inline size_t numchar(const std::string& a_string,char a_c){
0020 size_t num = 0;
0021 std::string::const_iterator it;
0022 for(it=a_string.begin();it!=a_string.end();++it) {
0023 if((*it)==a_c) num++;
0024 }
0025 return num;
0026 }
0027
0028 inline bool is_spaces(const std::string& a_string){
0029 std::string::const_iterator it;
0030 for(it=a_string.begin();it!=a_string.end();++it) {
0031 if((*it)!=' ') return false;
0032 }
0033 return true;
0034 }
0035
0036 //inline std::string::size_type find_not(const std::string& a_s,char a_c) {
0037 // std::string::size_type _size = a_s.size();
0038 // const char* p = a_s.c_str();
0039 // for(std::string::size_type pos=0;pos<_size;pos++,p++) {
0040 // if((*p)!=a_c) return pos;
0041 // }
0042 // return std::string::npos;
0043 //}
0044
0045 }
0046
0047 #endif