| 1 |
'\" t |
| 2 |
.\" Copyright 1993, David Metcalfe <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 6 |
.\" |
| 7 |
.TH strcoll 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
strcoll \- compare two strings using the current locale |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #include <string.h> |
| 16 |
.P |
| 17 |
.BI "int strcoll(const char *" s1 ", const char *" s2 ); |
| 18 |
.fi |
| 19 |
.SH DESCRIPTION |
| 20 |
The |
| 21 |
.BR strcoll () |
| 22 |
function compares the two strings |
| 23 |
.I s1 |
| 24 |
and |
| 25 |
.IR s2 . |
| 26 |
It returns an integer less than, equal to, or greater |
| 27 |
than zero if |
| 28 |
.I s1 |
| 29 |
is found, respectively, to be less than, |
| 30 |
to match, or be greater than |
| 31 |
.IR s2 . |
| 32 |
The comparison is based on |
| 33 |
strings interpreted as appropriate for the program's current locale |
| 34 |
for category |
| 35 |
.BR LC_COLLATE . |
| 36 |
(See |
| 37 |
.BR setlocale (3).) |
| 38 |
.SH RETURN VALUE |
| 39 |
The |
| 40 |
.BR strcoll () |
| 41 |
function returns an integer less than, equal to, |
| 42 |
or greater than zero if |
| 43 |
.I s1 |
| 44 |
is found, respectively, to be less |
| 45 |
than, to match, or be greater than |
| 46 |
.IR s2 , |
| 47 |
when both are interpreted |
| 48 |
as appropriate for the current locale. |
| 49 |
.SH ATTRIBUTES |
| 50 |
For an explanation of the terms used in this section, see |
| 51 |
.BR attributes (7). |
| 52 |
.TS |
| 53 |
allbox; |
| 54 |
lbx lb lb |
| 55 |
l l l. |
| 56 |
Interface Attribute Value |
| 57 |
T{ |
| 58 |
.na |
| 59 |
.nh |
| 60 |
.BR strcoll () |
| 61 |
T} Thread safety MT-Safe locale |
| 62 |
.TE |
| 63 |
.SH STANDARDS |
| 64 |
C11, POSIX.1-2008. |
| 65 |
.SH HISTORY |
| 66 |
POSIX.1-2001, C89, SVr4, 4.3BSD. |
| 67 |
.SH NOTES |
| 68 |
In the |
| 69 |
.I "POSIX" |
| 70 |
or |
| 71 |
.I "C" |
| 72 |
locales |
| 73 |
.BR strcoll () |
| 74 |
is equivalent to |
| 75 |
.BR strcmp (3). |
| 76 |
.SH SEE ALSO |
| 77 |
.BR memcmp (3), |
| 78 |
.BR setlocale (3), |
| 79 |
.BR strcasecmp (3), |
| 80 |
.BR strcmp (3), |
| 81 |
.BR string (3), |
| 82 |
.BR strxfrm (3) |