strcasecmp(), strcasecmp_l(), strncasecmp(), strncasecmp_l()

compare two character strings, ignoring case 

Function


SYNOPSIS

#include <string.h>

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

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

#include <locale.h>

int strcasecmp_l(const char *s1, const char *s2, locale_t locale);

int strncasecmp_l(const char *s1, const char *s2, size_t n, locale_t locale);


DESCRIPTION

The strcasecmp() routine does a case-insensitive string comparison (using the current thread or process locale) between the strings referenced by the pointers s1 and s2.

The strncasecmp() routine is the same as strncasecmp() but stops after n characters.

strcasecmp_l() and strncasecmp_l() behave in the same way as strcasecmp() and strncasecmp() without the _l suffix, but uses the specified locale rather than the global or per-thread locale. A locale_t is returned by newlocale().


PARAMETERS

s1 

Is the null-terminated string to be compared.

s2 

Is the null-terminated string to be compared.

locale 

Is a locale_t perhaps returned by newlocale() or LC_GLOBAL_LOCALE or 0 for the current thread locale set with uselocale().


RETURN VALUES

The function strcasecmp() class of functions return a positive integer if, disregarding case, string s1 is lexically greater than string s2; zero if, other than case the two strings are identical; and a negative integer if, disregarding case, string s1 is lexically less than string s2.


CONFORMANCE

strcasecmp() conforms to UNIX 98.

strncasecmp() conforms to IEEE Std 1003.1-2008 'POSIX.1'.

strcasecmp_l() and strncasecmp_l() conform to IEEE Std 1003.1-2008 'POSIX.1'.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
newlocale(), setlocale(), strcmp(), strcmp_l(), strcoll(), strcoll_l(), strncmp(), strncmp_l()


PTC MKS Toolkit 10.1 Documentation Build 15.