DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

strcasecmp(S-osr5)


strcasecmp, strncasecmp -- case-insensitive string comparisons

Syntax

cc . . . -lc

   #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, while ignoring differences in case, the string pointed to by s1 to the string pointed to by s2.

The strncasecmp function compares, while ignoring differences in case, not more than n bytes from the string pointed to by s1 to the string pointed to by s2.

These functions assume the ASCII character set when equating lower and upper case characters. In the POSIX locale, strcasecmp and strncasecmp do upper to lower conversions, then a byte comparison.

These functions operate on null-terminated strings. They do not check for overflow of any receiving string.

Return value

Upon completion, strcasecmp returns an integer greater than, equal to, or less than 0, if the string pointed to by s1 is, ignoring case, greater than, equal to or less than the string pointed to by s2, respectively.

Upon successful completion, strncasecmp returns an integer greater than, equal to, or less than 0, if the possibly null-terminated array pointed to by s1 is, ignoring case, greater than, equal to or less than the possibly null-terminated array pointed to by s2 respectively.

See also

bstring(S-osr5), malloc(S-osr5), string(S-osr5)

Notices

strcasecmp and strncasecmp use native character comparison as above and assume the ASCII character set.

Standards conformance

These routines conform to X/Open System Interfaces and Headers, Issue 4, Version 2.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005