1STRCASECMP(3)              Linux Programmer's Manual             STRCASECMP(3)
2
3
4

NAME

6       strcasecmp, strncasecmp - compare two strings ignoring case
7

SYNOPSIS

9       #include <strings.h>
10
11       int strcasecmp(const char *s1, const char *s2);
12       int strncasecmp(const char *s1, const char *s2, size_t n);
13

DESCRIPTION

15       The  strcasecmp()  function  performs  a byte-by-byte comparison of the
16       strings s1 and s2, ignoring the case of the characters.  It returns  an
17       integer  less  than, equal to, or greater than zero if s1 is found, re‐
18       spectively, to be less than, to match, or be greater than s2.
19
20       The strncasecmp() function is similar, except that it compares no  more
21       than n bytes of s1 and s2.
22

RETURN VALUE

24       The  strcasecmp()  and  strncasecmp()  functions return an integer less
25       than, equal to, or greater than zero if s1  is,  after  ignoring  case,
26       found to be less than, to match, or be greater than s2, respectively.
27

ATTRIBUTES

29       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
30       tributes(7).
31
32       ┌─────────────────────────────────────┬───────────────┬────────────────┐
33Interface                            Attribute     Value          
34       ├─────────────────────────────────────┼───────────────┼────────────────┤
35strcasecmp(), strncasecmp()          │ Thread safety │ MT-Safe locale │
36       └─────────────────────────────────────┴───────────────┴────────────────┘
37

CONFORMING TO

39       4.4BSD, POSIX.1-2001, POSIX.1-2008.
40

NOTES

42       The strcasecmp() and strncasecmp() functions first appeared in  4.4BSD,
43       where  they were declared in <string.h>.  Thus, for reasons of histori‐
44       cal compatibility, the glibc <string.h> header file also declares these
45       functions,  if  the  _DEFAULT_SOURCE  (or,  in  glibc 2.19 and earlier,
46       _BSD_SOURCE) feature test macro is defined.
47
48       The POSIX.1-2008 standard says of these functions:
49
50              When the LC_CTYPE category of the locale being used is from  the
51              POSIX locale, these functions shall behave as if the strings had
52              been converted to lowercase and  then  a  byte  comparison  per‐
53              formed.  Otherwise, the results are unspecified.
54

SEE ALSO

56       bcmp(3),  memcmp(3),  strcmp(3), strcoll(3), string(3), strncmp(3), wc‐
57       scasecmp(3), wcsncasecmp(3)
58

COLOPHON

60       This page is part of release 5.12 of the Linux  man-pages  project.   A
61       description  of  the project, information about reporting bugs, and the
62       latest    version    of    this    page,    can     be     found     at
63       https://www.kernel.org/doc/man-pages/.
64
65
66
67                                  2021-03-22                     STRCASECMP(3)
Impressum