CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
stringTools.h
Go to the documentation of this file.
1 #ifndef stringTools_h
2 #define stringTools_h
3 
4 #include<string>
5 
9 int replace(std::string & input, const std::string& gone, const std::string& it, bool multiple=false);
10 
14 int replaceRange(std::string & input, const std::string&first, const std::string& last, const std::string& it, bool multiple=false);
15 
16 
17 /*
18  remove leading and trailing "blanks"
19 */
20 void strip(std::string & input, const std::string& blanks=" \n\t");
21 
22 
26 public:
27  stringUpdate(const std::string & is) : s(is), old(0){}
28 
29  std::string operator()() {
30  if (s.size()>old) {
31  size_t d = old;
32  old = s.size();
33  return s.substr(d);
34  }
35  else return std::string();
36  }
37 
38  void reset() { old=0;}
39  bool updated() const { return s.size()>old;}
40 
41 private:
42 
43  const std::string & s;
44  size_t old;
45 };
46 
47 
48 #endif // stringTools_h
size_t old
Definition: stringTools.h:44
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
def replace
Definition: linker.py:10
std::string operator()()
Definition: stringTools.h:29
bool first
Definition: L1TdeRCT.cc:94
bool updated() const
Definition: stringTools.h:39
stringUpdate(const std::string &is)
Definition: stringTools.h:27
int replaceRange(std::string &input, const std::string &first, const std::string &last, const std::string &it, bool multiple=false)
void reset()
Definition: stringTools.h:38
const std::string & s
Definition: stringTools.h:43