+/* Returns true if SS starts with PREFIX, false otherwise. */
+bool
+ss_starts_with (struct substring ss, struct substring prefix)
+{
+ return (ss.length >= prefix.length
+ && !memcmp (ss.string, prefix.string, prefix.length));
+}
+
+/* Returns true if SS starts with PREFIX in any case, false otherwise. */
+bool
+ss_starts_with_case (struct substring ss, struct substring prefix)
+{
+ return (ss.length >= prefix.length
+ && !memcasecmp (ss.string, prefix.string, prefix.length));
+}
+
+/* Returns true if SS ends with SUFFIX, false otherwise. */
+bool
+ss_ends_with (struct substring ss, struct substring suffix)
+{
+ return (ss.length >= suffix.length
+ && !memcmp (&ss.string[ss.length - suffix.length], suffix.string,
+ suffix.length));
+}
+
+/* Returns true if SS ends with SUFFIX in any case, false otherwise. */
+bool
+ss_ends_with_case (struct substring ss, struct substring suffix)
+{
+ return (ss.length >= suffix.length
+ && !memcasecmp (&ss.string[ss.length - suffix.length], suffix.string,
+ suffix.length));
+}
+