CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
suffix.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module:
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
9
10#ifndef CPROVER_UTIL_SUFFIX_H
11#define CPROVER_UTIL_SUFFIX_H
12
13#include <string>
14
15// C++20 will have std::string::ends_with
16
17inline bool has_suffix(const std::string &s, const std::string &suffix)
18{
19 if(suffix.size()>s.size())
20 return false;
21 return s.compare(s.size()-suffix.size(), std::string::npos, suffix)==0;
22}
23
24#endif // CPROVER_UTIL_SUFFIX_H
bool has_suffix(const std::string &s, const std::string &suffix)
Definition suffix.h:17