Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

strcasecmp, strncasecmp - non-case-sensitive string comparison

&pagelevel(4)&pagelevel

Syntax

#include <strings.h>

int strcasecmp(const char *s1, const char *s2);

int strncasecmp(const char *s1, const char *s2, size_t n);

Description  The strcasecmp() function compares the string referenced by s1 with the string referenced

by s2. The strings to be compared must be terminated with the null byte. Uppercase
and lowercase are not distinguished. strncasecmp() is used in the same way, except that
no more than n bytes can be compared.

In the POSIX locale, strcasecmp() and strncasecmp() convert uppercase letters into
lowercase letters before they do the comparison. The results are not specified in other
locales.

Return val.

Integer

On successful execution, strcasecmp() returns an integer which is
greater than, equal to or less than zero, depending on whether the string
identified by s1 is greater than, equal to or less than the string referenced by
s2. No distinction is made between uppercase and lowercase.
strncasecmp() is used in the same way, except that no more than the first
n characters of both strings can be compared.

See also

strings.h.