From 122ec36b18d77bf94d6ffa8f24bc62036718dc35 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Thu, 27 Oct 2016 15:19:44 +0100 Subject: [PATCH] Add string-infix utility --- src/util/infix.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/util/infix.h diff --git a/src/util/infix.h b/src/util/infix.h new file mode 100644 index 00000000000..2fcc1338d5d --- /dev/null +++ b/src/util/infix.h @@ -0,0 +1,22 @@ +/*******************************************************************\ + +Module: String infix shorthand + +Author: Chris Smowton, chris.smowton@diffblue.com + +\*******************************************************************/ + +#ifndef CPROVER_UTIL_INFIX_H +#define CPROVER_UTIL_INFIX_H + +#include + +inline bool has_infix( + const std::string &s, + const std::string &infix, + size_t offset) +{ + return s.compare(offset, infix.size(), infix)==0; +} + +#endif