ucx/string.h

changeset 17
11dffb40cd91
parent 5
88625853ae74
child 39
3e55bed345f9
--- a/ucx/string.h	Fri Aug 16 12:41:30 2013 +0200
+++ b/ucx/string.h	Sat Aug 17 12:04:04 2013 +0200
@@ -54,6 +54,7 @@
 
 /** Shortcut for a <code>sstr_t struct</code> literal. */
 #define ST(s) { (char*)s, sizeof(s)-1 }
+
 /** Shortcut for the conversion of a C string to a <code>sstr_t</code>. */
 #define S(s) sstrn((char*)s, sizeof(s)-1)
 
@@ -338,6 +339,22 @@
  */
 sstr_t sstrtrim(sstr_t string);
 
+/**
+ * Checks, if a string has a specific prefix.
+ * @param string the string to check
+ * @param prefix the prefix the string should have
+ * @return 1, if and only if the string has the specified prefix, 0 otherwise
+ */
+int sstrprefix(sstr_t string, sstr_t prefix);
+
+/**
+ * Checks, if a string has a specific suffix.
+ * @param string the string to check
+ * @param suffix the suffix the string should have
+ * @return 1, if and only if the string has the specified suffix, 0 otherwise
+ */
+int sstrsuffix(sstr_t string, sstr_t suffix);
+
 #ifdef	__cplusplus
 }
 #endif

mercurial