File: arb_stdstr.h

package info (click to toggle)
arb 6.0.6-8
  • links: PTS, VCS
  • area: non-free
  • in suites: sid, trixie
  • size: 66,204 kB
  • sloc: ansic: 394,911; cpp: 250,290; makefile: 19,644; sh: 15,879; perl: 10,473; fortran: 6,019; ruby: 683; xml: 503; python: 53; awk: 32
file content (29 lines) | stat: -rw-r--r-- 1,148 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// =============================================================== //
//                                                                 //
//   File      : arb_stdstr.h                                      //
//   Purpose   : inlined string functions using std::string        //
//                                                                 //
//   Coded by Ralf Westram (coder@reallysoft.de) in June 2002      //
//   Institute of Microbiology (Technical University Munich)       //
//   http://www.arb-home.de/                                       //
//                                                                 //
// =============================================================== //

#ifndef ARB_STDSTR_H
#define ARB_STDSTR_H

inline bool beginsWith(const std::string& str, const std::string& start) {
    return str.find(start) == 0;
}

inline bool endsWith(const std::string& str, const std::string& postfix) {
    size_t slen = str.length();
    size_t plen = postfix.length();

    if (plen>slen) { return false; }
    return str.substr(slen-plen) == postfix;
}

#else
#error arb_stdstr.h included twice
#endif // ARB_STDSTR_H