Changeset 289 for trunk/lib/utility.h
- Timestamp:
- May 8, 2007, 2:48:07 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/utility.h
r274 r289 132 132 /// 133 133 inline std::string trim(std::string str) { return htrim(ltrim(str)); } 134 135 136 template <class T> 137 std::string match(std::string::const_iterator& first, 138 const std::string::const_iterator& last, 139 const T& func) 140 { 141 std::string res; 142 for (;first!=last && func(*first); ++first) 143 res.append(1,*first); 144 return res; 145 } 146 147 struct Digit 148 { 149 inline bool operator()(char c) const { return isdigit(c); } 150 }; 151 152 class notChar 153 { 154 public: 155 notChar(char); 156 inline bool operator()(char c) const { return c!=char_; } 157 private: 158 char char_; 159 }; 160 161 class not2Char 162 { 163 public: 164 not2Char(char, char); 165 inline bool operator()(char c) const 166 { return c!=char1_ && c!=char2_; } 167 private: 168 const char char1_; 169 const char char2_; 170 }; 134 171 135 172 ///
Note: See TracChangeset
for help on using the changeset viewer.