starts_with.hpp
Go to the documentation of this file.
1 #ifndef STAN_IO_STARTS_WITH_HPP
2 #define STAN_IO_STARTS_WITH_HPP
3 
4 #include <string>
5 
6 namespace stan {
7  namespace io {
8 
9  /**
10  * Return true if the specified string starts with the specified
11  * prefix.
12  *
13  * @param p prefix
14  * @param s string to test
15  * @return true if s has p as a prefix
16  */
17  inline bool starts_with(const std::string& p,
18  const std::string& s) {
19  return s.size() >= p.size() && s.substr(0, p.size()) == p;
20  }
21 
22  }
23 }
24 #endif
const char * p
Definition: xmltok.h:285
bool starts_with(const std::string &p, const std::string &s)
Definition: starts_with.hpp:17
const XML_Char * s
Definition: expat.h:262
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154