stricmp -- Compare Strings as Lowercase

Format

#include <string.h>
int stricmp(const char *string1, const char *string2);

Language Level: Extension
stricmp compares string1 and string2 without sensitivity for case. All alphabetic characters in the arguments string1 and string2 are converted to lowercase before the comparison. stricmp operates on null-terminated strings.

Return Value
stricmp returns a value that indicates the following relationship between the two strings:

Value Meaning
Less than 0 string1 less than string2
0 string1 identical to string2
Greater than 0 string1 greater than string2.

Example
This example uses stricmp to compare two strings.

#include <stdio.h>
#include <string.h>
int main(void)
{
   char *str1 = "this is a string";
   char *str2 = "THIS IS A STRING";
   /* Compare two strings without regard to case                              */
   if (stricmp(str1, str2))
      printf("str1 is not the same as str2\n");
   else
      printf("str1 is the same as str2\n");
   return 0;
   /*******************************************
      The output should be:
      str1 is the same as str2
   *******************************************/
}



strcmp -- Compare Strings
strcmpi -- Compare Strings Without Case Sensitivity
strcspn -- Compare Strings for Substrings
strncmp -- Compare Strings
strnicmp -- Compare Strings Without Case Sensitivity
wcscmp -- Compare Wide-Character Strings
wcsncmp -- Compare Wide-Character Strings
<string.h>