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
11
13 strcasecmp, strcasecmp_l, strncasecmp, strncasecmp_l — case-insensitive
14 string comparisons
15
17 #include <strings.h>
18
19 int strcasecmp(const char *s1, const char *s2);
20 int strcasecmp_l(const char *s1, const char *s2,
21 locale_t locale);
22 int strncasecmp(const char *s1, const char *s2, size_t n);
23 int strncasecmp_l(const char *s1, const char *s2,
24 size_t n, locale_t locale);
25
27 The strcasecmp() and strcasecmp_l() functions shall compare, while
28 ignoring differences in case, the string pointed to by s1 to the string
29 pointed to by s2. The strncasecmp() and strncasecmp_l() functions
30 shall compare, while ignoring differences in case, not more than n
31 bytes from the string pointed to by s1 to the string pointed to by s2.
32
33 The strcasecmp() and strncasecmp() functions use the current locale to
34 determine the case of the characters.
35
36 The strcasecmp_l() and strncasecmp_l() functions use the locale repre‐
37 sented by locale to determine the case of the characters.
38
39 When the LC_CTYPE category of the locale being used is from the POSIX
40 locale, these functions shall behave as if the strings had been con‐
41 verted to lowercase and then a byte comparison performed. Otherwise,
42 the results are unspecified.
43
44 The behavior is undefined if the locale argument to strcasecmp_l() or
45 strncasecmp_l() is the special locale object LC_GLOBAL_LOCALE or is not
46 a valid locale object handle.
47
49 Upon completion, strcasecmp() and strcasecmp_l() shall return an inte‐
50 ger greater than, equal to, or less than 0, if the string pointed to by
51 s1 is, ignoring case, greater than, equal to, or less than the string
52 pointed to by s2, respectively.
53
54 Upon successful completion, strncasecmp() and strncasecmp_l() shall
55 return an integer greater than, equal to, or less than 0, if the possi‐
56 bly null-terminated array pointed to by s1 is, ignoring case, greater
57 than, equal to, or less than the possibly null-terminated array pointed
58 to by s2, respectively.
59
61 No errors are defined.
62
63 The following sections are informative.
64
66 None.
67
69 None.
70
72 None.
73
75 None.
76
78 wcscasecmp()
79
80 The Base Definitions volume of POSIX.1‐2008, <strings.h>
81
83 Portions of this text are reprinted and reproduced in electronic form
84 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
85 -- Portable Operating System Interface (POSIX), The Open Group Base
86 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
87 cal and Electronics Engineers, Inc and The Open Group. (This is
88 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
89 event of any discrepancy between this version and the original IEEE and
90 The Open Group Standard, the original IEEE and The Open Group Standard
91 is the referee document. The original Standard can be obtained online
92 at http://www.unix.org/online.html .
93
94 Any typographical or formatting errors that appear in this page are
95 most likely to have been introduced during the conversion of the source
96 files to man page format. To report such errors, see https://www.ker‐
97 nel.org/doc/man-pages/reporting_bugs.html .
98
99
100
101IEEE/The Open Group 2013 STRCASECMP(3P)