comparison common/strhelp.h @ 138:7a8d960d60c9

Merged
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 24 Mar 2014 14:57:37 +0000
parents c719d3fdbc15
children bf4bfd8843bd
comparison
equal deleted inserted replaced
137:4904fe01055d 138:7a8d960d60c9
1 #ifndef STRHELP_H 1 #ifndef STRHELP_H
2 #define STRHELP_H 2 #define STRHELP_H
3
4 #include <stdbool.h>
3 5
4 /** 6 /**
5 * @file strhelp.h 7 * @file strhelp.h
6 * @brief Helper functions for c strings and memory management 8 * @brief Helper functions for c strings and memory management
7 * @details strhelp contains terminating memory allocation functions and 9 * @details strhelp contains terminating memory allocation functions and
45 /** 47 /**
46 * @brief Frees the given %NULL-terminated string array. 48 * @brief Frees the given %NULL-terminated string array.
47 * @param[inout] str_array a %NULL-terminated array of strings 49 * @param[inout] str_array a %NULL-terminated array of strings
48 */ 50 */
49 void strv_free (char **str_array); 51 void strv_free (char **str_array);
52
53 /**
54 * @brief Checks whether two strings exactly match
55 * @param[in] s1 the first string
56 * @param[in] s2 the second string
57 * @returns true if s1 and s2 are equal
58 */
59 bool str_equal (char *s1, char *s2);
60
61 /**
62 * @brief Checks whether s2 exactly matches the beginning of s1.
63 * @param[in] s1 the string who's beginning is searched
64 * @param[in] s2 the string which is searched for
65 * @returns true if s1 starts with s2, false otherwise
66 */
67 bool str_starts_with (char *s1, char *s2);
68
69 /**
70 * @brief Trims all white space from the start and end of string.
71 * @details the start of the string is trimmed by setting *s to the
72 * first non white space character. The end is trimmed by setting the
73 * first character after the last non white space character to \0.
74 * @param[inout] s ponter to the string to strip
75 */
76 bool str_trim (char **s);
77
50 #endif 78 #endif

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