1STRCASECMP(3P) POSIX Programmer's Manual STRCASECMP(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 strcasecmp, strcasecmp_l, strncasecmp, strncasecmp_l — case-insensitive
13 string comparisons
14
16 #include <strings.h>
17
18 int strcasecmp(const char *s1, const char *s2);
19 int strcasecmp_l(const char *s1, const char *s2,
20 locale_t locale);
21 int strncasecmp(const char *s1, const char *s2, size_t n);
22 int strncasecmp_l(const char *s1, const char *s2,
23 size_t n, locale_t locale);
24
26 The strcasecmp() and strcasecmp_l() functions shall compare, while
27 ignoring differences in case, the string pointed to by s1 to the string
28 pointed to by s2. The strncasecmp() and strncasecmp_l() functions
29 shall compare, while ignoring differences in case, not more than n
30 bytes from the string pointed to by s1 to the string pointed to by s2.
31
32 The strcasecmp() and strncasecmp() functions use the current locale to
33 determine the case of the characters.
34
35 The strcasecmp_l() and strncasecmp_l() functions use the locale repre‐
36 sented by locale to determine the case of the characters.
37
38 When the LC_CTYPE category of the locale being used is from the POSIX
39 locale, these functions shall behave as if the strings had been con‐
40 verted to lowercase and then a byte comparison performed. Otherwise,
41 the results are unspecified.
42
43 The behavior is undefined if the locale argument to strcasecmp_l() or
44 strncasecmp_l() is the special locale object LC_GLOBAL_LOCALE or is not
45 a valid locale object handle.
46
48 Upon completion, strcasecmp() and strcasecmp_l() shall return an inte‐
49 ger greater than, equal to, or less than 0, if the string pointed to by
50 s1 is, ignoring case, greater than, equal to, or less than the string
51 pointed to by s2, respectively.
52
53 Upon successful completion, strncasecmp() and strncasecmp_l() shall
54 return an integer greater than, equal to, or less than 0, if the possi‐
55 bly null-terminated array pointed to by s1 is, ignoring case, greater
56 than, equal to, or less than the possibly null-terminated array pointed
57 to by s2, respectively.
58
60 No errors are defined.
61
62 The following sections are informative.
63
65 None.
66
68 None.
69
71 None.
72
74 None.
75
77 wcscasecmp()
78
79 The Base Definitions volume of POSIX.1‐2017, <strings.h>
80
82 Portions of this text are reprinted and reproduced in electronic form
83 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
84 table Operating System Interface (POSIX), The Open Group Base Specifi‐
85 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
86 Electrical and Electronics Engineers, Inc and The Open Group. In the
87 event of any discrepancy between this version and the original IEEE and
88 The Open Group Standard, the original IEEE and The Open Group Standard
89 is the referee document. The original Standard can be obtained online
90 at http://www.opengroup.org/unix/online.html .
91
92 Any typographical or formatting errors that appear in this page are
93 most likely to have been introduced during the conversion of the source
94 files to man page format. To report such errors, see https://www.ker‐
95 nel.org/doc/man-pages/reporting_bugs.html .
96
97
98
99IEEE/The Open Group 2017 STRCASECMP(3P)