ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
prefix.h
Go to the documentation of this file.
1#ifndef CPROVER_UTIL_PREFIX_H
2#define CPROVER_UTIL_PREFIX_H
3
4#include <string_view>
5
6inline bool has_prefix(std::string_view s, std::string_view prefix)
7{
8 size_t n = prefix.size();
9 return s.size() >= n && s.substr(0, n) == prefix;
10}
11
12inline bool has_suffix(std::string_view s, std::string_view suffix)
13{
14 size_t n = suffix.size();
15 size_t m = s.size();
16 return m >= n && s.substr(m - n) == suffix;
17}
18
19#endif
bool has_prefix(std::string_view s, std::string_view prefix)
Definition prefix.h:6
bool has_suffix(std::string_view s, std::string_view suffix)
Definition prefix.h:12