strcasecmp() — Case-insensitive string comparison

Standards

Standards / Extensions C or C++ Dependencies

XPG4.2
Single UNIX Specification, Version 3

both  

Format

#define  _XOPEN_SOURCE_EXTENDED 1
#include <strings.h>

int strcasecmp(const char *string1, const char *string2);

General description

The strcasecmp() function compares, while ignoring differences in case, the string pointed to by string1 to the string pointed to by string2.

The string arguments to the function must contain a NULL character (\0) marking the end of the string.

The strcasecmp() function is locale-sensitive.

Returned value

strcasecmp() returns a value indicating the relationship between the strings, while ignoring case, as follows:
Value
Meaning
< 0
String pointed to by string1 is less than string pointed to by string2.
= 0
String pointed to by string1 is equal to string pointed to by string2.
> 0
String pointed to by string1 is greater than string pointed to by string2.

There are no errno values defined.

Related information