aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'e-util/e-util.c')
-rw-r--r--e-util/e-util.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 3dea9282c3..c8c60fe1b3 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -305,3 +305,27 @@ e_strsplit (const gchar *string,
return str_array;
}
+
+gchar *
+e_strstrcase (const gchar *haystack, const gchar *needle)
+{
+ /* find the needle in the haystack neglecting case */
+ gchar *ptr;
+ guint len;
+
+ g_return_val_if_fail (haystack != NULL, NULL);
+ g_return_val_if_fail (needle != NULL, NULL);
+
+ len = strlen(needle);
+ if (len > strlen(haystack))
+ return NULL;
+
+ if (len == 0)
+ return haystack;
+
+ for (ptr = (char *)haystack; *(ptr + len - 1) != '\0'; ptr++)
+ if (!g_strncasecmp(ptr, needle, len))
+ return ptr;
+
+ return NULL;
+}