aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-10-10 17:15:49 +0200
committerMattias Andrée <maandree@operamail.com>2015-10-10 17:17:49 +0200
commitae2709a72b748e1656b7067951e0532dfe45ae2d (patch)
treefee49a5ff60f363fa220bf2c73cd76dbbf0e505d /include
parentm doc (diff)
downloadslibc-ae2709a72b748e1656b7067951e0532dfe45ae2d.tar.gz
slibc-ae2709a72b748e1656b7067951e0532dfe45ae2d.tar.bz2
slibc-ae2709a72b748e1656b7067951e0532dfe45ae2d.tar.xz
add strstarts strends strcasestarts strcaseends wcsstarts wcsends wcscasestarts wcscaseends
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'include')
-rw-r--r--include/string.h56
-rw-r--r--include/wchar.h56
2 files changed, 112 insertions, 0 deletions
diff --git a/include/string.h b/include/string.h
index b851a76..08777be 100644
--- a/include/string.h
+++ b/include/string.h
@@ -969,6 +969,62 @@ char* rawstrcasestr(const char*, const char*)
*/
void* memcasemem(const void*, size_t, const void*, size_t)
__GCC_ONLY(__attribute__((warn_unused_result, pure)));
+
+/**
+ * Check whether a string starts with a specific string.
+ * This check is case sensitive.
+ *
+ * This is a slibc extension.
+ *
+ * @param string The string to inspect.
+ * @param desired The desired beginning of the string.
+ * @return `string` if `string` begins with
+ * `desired`, `NULL` otherwise.
+ */
+char* strstarts(const char*, const char*)
+ __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure)));
+
+/**
+ * Check whether a string ends with a specific string.
+ * This check is case sensitive.
+ *
+ * This is a slibc extension.
+ *
+ * @param string The string to inspect.
+ * @param desired The desired ending of the string.
+ * @return The `string`, where `desired` beings if
+ * `string` ends with `desired`, `NULL` otherwise.
+ */
+char* strends(const char*, const char*)
+ __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure)));
+
+/**
+ * Check whether a string starts with a specific string.
+ * This check is case insensitive.
+ *
+ * This is a slibc extension.
+ *
+ * @param string The string to inspect.
+ * @param desired The desired beginning of the string.
+ * @return `string` if `string` begins with
+ * `desired`, `NULL` otherwise.
+ */
+char* strcasestarts(const char*, const char*)
+ __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure)));
+
+/**
+ * Check whether a string ends with a specific string.
+ * This check is case insensitive.
+ *
+ * This is a slibc extension.
+ *
+ * @param string The string to inspect.
+ * @param desired The desired ending of the string.
+ * @return The `string`, where `desired` beings if
+ * `string` ends with `desired`, `NULL` otherwise.
+ */
+char* strcaseends(const char*, const char*)
+ __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure)));
#endif
#if (defined(_GNU_SOURCE) || defined(_SLIBC_SOURCE)) && !defined(__PORTABLE)
diff --git a/include/wchar.h b/include/wchar.h
index 9b57a7e..e9d2daa 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -942,6 +942,62 @@ wchar_t* rawwcscasestr(const wchar_t*, const wchar_t*)
*/
wchar_t* wmemcasemem(const wchar_t*, size_t, const wchar_t*, size_t)
__GCC_ONLY(__attribute__((warn_unused_result, pure)));
+
+/**
+ * Check whether a string starts with a specific string.
+ * This check is case sensitive.
+ *
+ * This is a slibc extension.
+ *
+ * @param string The string to inspect.
+ * @param desired The desired beginning of the string.
+ * @return `string` if `string` begins with
+ * `desired`, `NULL` otherwise.
+ */
+wchar_t* wcsstarts(const wchar_t*, const wchar_t*)
+ __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure)));
+
+/**
+ * Check whether a string ends with a specific string.
+ * This check is case sensitive.
+ *
+ * This is a slibc extension.
+ *
+ * @param string The string to inspect.
+ * @param desired The desired ending of the string.
+ * @return The `string`, where `desired` beings if
+ * `string` ends with `desired`, `NULL` otherwise.
+ */
+wchar_t* wcsends(const wchar_t*, const wchar_t*)
+ __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure)));
+
+/**
+ * Check whether a string starts with a specific string.
+ * This check is case insensitive.
+ *
+ * This is a slibc extension.
+ *
+ * @param string The string to inspect.
+ * @param desired The desired beginning of the string.
+ * @return `string` if `string` begins with
+ * `desired`, `NULL` otherwise.
+ */
+wchar_t* wcscasestarts(const wchar_t*, const wchar_t*)
+ __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure)));
+
+/**
+ * Check whether a string ends with a specific string.
+ * This check is case insensitive.
+ *
+ * This is a slibc extension.
+ *
+ * @param string The string to inspect.
+ * @param desired The desired ending of the string.
+ * @return The `string`, where `desired` beings if
+ * `string` ends with `desired`, `NULL` otherwise.
+ */
+wchar_t* wcscaseends(const wchar_t*, const wchar_t*)
+ __GCC_ONLY(__attribute__((warn_unused_result, nonnull, pure)));
#endif
#if (defined(_GNU_SOURCE) || defined(_SLIBC_SOURCE)) && !defined(__PORTABLE)