Changeset 395 for cpp/frams/util/sstring-simple.cpp
- Timestamp:
- 06/23/15 00:50:52 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/util/sstring-simple.cpp
r385 r395 167 167 /////////////////////////////////////// 168 168 169 intSString::equals(const SString& s) const170 { 171 if (this==&s) return 1;172 if (len()!=s.len()) return 0;173 return !strcmp(getPtr(),s.getPtr());169 bool SString::equals(const SString& s) const 170 { 171 if (this==&s) return true; 172 if (len()!=s.len()) return false; 173 return strcmp(getPtr(),s.getPtr())==0; 174 174 } 175 175 … … 194 194 } 195 195 196 intSString::getNextToken (int& pos,SString &token,char separator) const197 { 198 if (pos>=len()) {token=0;return 0;}196 bool SString::getNextToken (int& pos,SString &token,char separator) const 197 { 198 if (pos>=len()) {token=0;return false;} 199 199 int p1=pos,p2; 200 200 const char *t1=getPtr()+pos; … … 203 203 strncpy(token.directWrite(p2-p1),t1,p2-p1); 204 204 token.endWrite(p2-p1); 205 return 1;206 } 207 208 intSString::startsWith(const char *pattern) const205 return true; 206 } 207 208 bool SString::startsWith(const char *pattern) const 209 209 { 210 210 const char *t=this->c_str(); 211 211 for (;*pattern;pattern++,t++) 212 if (*t != *pattern) return 0;213 return 1;212 if (*t != *pattern) return false; 213 return true; 214 214 } 215 215
Note: See TracChangeset
for help on using the changeset viewer.