Add IdString::ends_with()
authorEddie Hung <eddieh@ece.ubc.ca>
Tue, 26 Feb 2019 20:04:16 +0000 (12:04 -0800)
committerEddie Hung <eddieh@ece.ubc.ca>
Tue, 26 Feb 2019 20:04:16 +0000 (12:04 -0800)
kernel/rtlil.h

index f877622aa4f781e20cc21a6ef4ce36adb3a36f31..eb71fec7b63eca9e43f83c166cbfc60c97c00f15 100644 (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();
                }