diff options
Diffstat (limited to 'src/libutil/StringUtils.cpp')
-rw-r--r-- | src/libutil/StringUtils.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libutil/StringUtils.cpp b/src/libutil/StringUtils.cpp index 13be8d4..640ce20 100644 --- a/src/libutil/StringUtils.cpp +++ b/src/libutil/StringUtils.cpp @@ -45,3 +45,15 @@ std::vector<std::string> split( const string &s, const string &delimiter, bool k return result; } + +bool endswith( const string &s, const string &endstring ) +{ + unsigned int pos = s.rfind( endstring ); + return pos != string::npos && pos + endstring.length( ) == s.length( ); +} + +bool startswith( const string &s, const string &startstring ) +{ + unsigned int pos = s.find( startstring ); + return pos != string::npos; +} |