Add IdString::ends_with()

This commit is contained in:
Eddie Hung 2019-02-26 12:04:16 -08:00
parent 66b5f5166b
commit 3ea0161ae7
1 changed files with 6 additions and 0 deletions

View File

@ -222,6 +222,12 @@ namespace RTLIL
return std::string(c_str() + pos, len);
}
bool ends_with(const char* suffix) const {
size_t len = strlen(suffix);
if (size() < len) return false;
return substr(size()-len) == suffix;
}
size_t size() const {
return str().size();
}