diff common/strhelp.h @ 131:9104b1b2e4da

Added string comparison functions.
author Sascha Wilde <wilde@intevation.de>
date Mon, 24 Mar 2014 13:32:12 +0100
parents 702033705bb8
children c719d3fdbc15
line wrap: on
line diff
--- a/common/strhelp.h	Mon Mar 24 10:06:43 2014 +0100
+++ b/common/strhelp.h	Mon Mar 24 13:32:12 2014 +0100
@@ -1,6 +1,8 @@
 #ifndef STRHELP_H
 #define STRHELP_H
 
+#include <stdbool.h>
+
 /**
  * @file  strhelp.h
  * @brief Helper functions for c strings and memory management
@@ -47,4 +49,21 @@
  * @param[inout] str_array a %NULL-terminated array of strings
  */
 void strv_free (char **str_array);
+
+/**
+ * @brief Checks whether two strings exactly match
+ * @param[in] s1 the first string
+ * @param[in] s2 the second string
+ * @returns true if s1 and s2 are equal
+ */
+bool str_equal (char *s1, char *s2);
+
+/**
+ * @brief Checks whether s2 exactly matches the beginning of s1.
+ * @param[in] s1 the string who's beginning is searched
+ * @param[in] s2 the string which is searched for
+ * @returns true if s1 starts with s2, false otherwise
+ */
+bool str_starts_with (char *s1, char *s2);
+
 #endif

http://wald.intevation.org/projects/trustbridge/