1strcasecmp(3)              Library Functions Manual              strcasecmp(3)
2
3
4

NAME

6       strcasecmp, strncasecmp - compare two strings ignoring case
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

12       #include <strings.h>
13
14       int strcasecmp(const char *s1, const char *s2);
15       int strncasecmp(const char s1[.n], const char s2[.n], size_t n);
16

DESCRIPTION

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

RETURN VALUE

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

ATTRIBUTES

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

STANDARDS

42       POSIX.1-2008.
43

HISTORY

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

SEE ALSO

61       memcmp(3), strcmp(3), strcoll(3), string(3), strncmp(3), wcscasecmp(3),
62       wcsncasecmp(3)
63
64
65
66Linux man-pages 6.05              2023-07-20                     strcasecmp(3)
Impressum