xref: /original-bsd/lib/libc/string/strcasecmp.3 (revision 3705696b)
1.\" Copyright (c) 1990, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Chris Torek.
6.\" %sccs.include.redist.man%
7.\"
8.\"     @(#)strcasecmp.3	8.1 (Berkeley) 06/09/93
9.\"
10.Dd
11.Dt STRCASECMP 3
12.Os
13.Sh NAME
14.Nm strcasecmp
15.Nd compare strings, ignoring case
16.Sh SYNOPSIS
17.Fd #include <string.h>
18.Ft int
19.Fn strcasecmp "const char *s1" "const char *s2"
20.Ft int
21.Fn strncasecmp "const char *s1" "const char *s2" "size_t len"
22.Sh DESCRIPTION
23The
24.Fn strcasecmp
25and
26.Fn strncasecmp
27functions
28compare the null-terminated strings
29.Fa s1
30and
31.Fa s2
32and return an integer greater than, equal to, or less than 0,
33according as
34.Fa s1
35is lexicographically greater than, equal to, or less than
36.Fa s2
37after translation of each corresponding character to lower-case.
38The strings themselves are not modified.
39The comparison is done using unsigned characters, so that
40.Sq Li \e200
41is greater than
42.Ql \e0 .
43.Pp
44The
45.Fn strncasecmp
46compares at most
47.Fa len
48characters.
49.Sh SEE ALSO
50.Xr bcmp 3 ,
51.Xr memcmp 3 ,
52.Xr strcmp 3 ,
53.Xr strcoll 3 ,
54.Xr strxfrm 3
55.Sh HISTORY
56The
57.Fn strcasecmp
58and
59.Fn strncasecmp
60functions first appeared in 4.4BSD.
61