tesseract
3.03
|
Go to the source code of this file.
Functions | |
char * | strcasestr (const char *haystack, const char *needle) |
Locatea substring into a string, ignoring case. |
char* strcasestr | ( | const char * | haystack, |
const char * | needle | ||
) |
Locatea substring into a string, ignoring case.
haystack | The string to search in. |
needle | The substring to find. |
This function locates the string needle
into the string haystack
, ignoring the case of the characters. It returns apointer to the beginning of the substring, or NULL if the substring is not found. If haystack
or needle
are NULL
, this function returns NULL
.
Conformity: Non applicable.
Supported OS: Windows XP, Windows CE
Definition at line 43 of file strcasestr.cpp.
{ size_t length_needle; size_t length_haystack; size_t i; if (!haystack || !needle) return NULL; length_needle = strlen(needle); length_haystack = strlen(haystack) - length_needle + 1; for (i = 0; i < length_haystack; i++) { size_t j; for (j = 0; j < length_needle; j++) { unsigned char c1; unsigned char c2; c1 = haystack[i+j]; c2 = needle[j]; if (toupper(c1) != toupper(c2)) goto next; } return (char *) haystack + i; next: ; } return NULL; }