You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2006/10/04 20:04:17 UTC
svn commit: r452956 - in /webservices/axis2/trunk/c/util:
include/axis2_string.h src/string.c
Author: samisa
Date: Wed Oct 4 11:04:16 2006
New Revision: 452956
URL: http://svn.apache.org/viewvc?view=rev&rev=452956
Log:
Added strcasestr
Modified:
webservices/axis2/trunk/c/util/include/axis2_string.h
webservices/axis2/trunk/c/util/src/string.c
Modified: webservices/axis2/trunk/c/util/include/axis2_string.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/include/axis2_string.h?view=diff&rev=452956&r1=452955&r2=452956
==============================================================================
--- webservices/axis2/trunk/c/util/include/axis2_string.h (original)
+++ webservices/axis2/trunk/c/util/include/axis2_string.h Wed Oct 4 11:04:16 2006
@@ -195,7 +195,18 @@
axis2_string_toupper(
axis2_char_t *str );
-
+ /**
+ * Finds the first occurrence of the substring needle in the string
+ * haystack, ignores the case of both arguments.
+ * @param haystack string in which the given string is to be found
+ * @param needle string to be found in haystack
+ * @return pointer to the beginning of the substring,
+ * or NULL if the substring is not found
+ */
+ AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+ axis2_strcasestr(
+ const axis2_char_t *heystack,
+ const axis2_char_t *needle);
#define AXIS2_STRDUP(pts, env) \
Modified: webservices/axis2/trunk/c/util/src/string.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/string.c?view=diff&rev=452956&r1=452955&r2=452956
==============================================================================
--- webservices/axis2/trunk/c/util/src/string.c (original)
+++ webservices/axis2/trunk/c/util/src/string.c Wed Oct 4 11:04:16 2006
@@ -445,3 +445,28 @@
return str;
}
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+axis2_strcasestr(const axis2_char_t *heystack, const axis2_char_t *needle)
+{
+ axis2_char_t start, current;
+ size_t len;
+
+ if (!heystack || !needle)
+ return NULL;
+
+ if ((start = *needle++))
+ {
+ len = strlen(needle);
+ do
+ {
+ do
+ {
+ if (!(current = *heystack++))
+ return (NULL);
+ } while (toupper(current) != toupper(start));
+ } while (strncasecmp(heystack, needle, len));
+ heystack--;
+ }
+ return (axis2_char_t *)heystack;
+}
+
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org