]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libc/locale/isdigit.3
zfs: merge openzfs/zfs@009d3288d
[FreeBSD/FreeBSD.git] / lib / libc / locale / isdigit.3
1 .\" Copyright (c) 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 .\" the American National Standards Committee X3, on Information
6 .\" Processing Systems.
7 .\"
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
10 .\" are met:
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\"    notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\"    notice, this list of conditions and the following disclaimer in the
15 .\"    documentation and/or other materials provided with the distribution.
16 .\" 3. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)isdigit.3   8.1 (Berkeley) 6/4/93
33 .\" $FreeBSD$
34 .\"
35 .Dd December 19, 2022
36 .Dt ISDIGIT 3
37 .Os
38 .Sh NAME
39 .Nm isdigit ,
40 .Nm isnumber ,
41 .Nm isdigit_l ,
42 .Nm isnumber_l
43 .Nd decimal-digit character test
44 .Sh LIBRARY
45 .Lb libc
46 .Sh SYNOPSIS
47 .In ctype.h
48 .Ft int
49 .Fn isdigit "int c"
50 .Ft int
51 .Fn isnumber "int c"
52 .Ft int
53 .Fn isdigit_l "int c" "locale_t loc"
54 .Ft int
55 .Fn isnumber_l "int c" "locale_t loc"
56 .Sh DESCRIPTION
57 The
58 .Fn isdigit
59 and
60 .Fn isdigit_l
61 functions test for a decimal digit character.
62 Regardless of locale, this includes the following characters only:
63 .Bl -column \&``0''______ \&``0''______ \&``0''______ \&``0''______ \&``0''______
64 .It "\&``0''" Ta "``1''" Ta "``2''" Ta "``3''" Ta "``4''"
65 .It "\&``5''" Ta "``6''" Ta "``7''" Ta "``8''" Ta "``9''"
66 .El
67 .Pp
68 The
69 .Fn isnumber
70 and
71 .Fn isnumber_l
72 functions behave similarly to
73 .Fn isdigit
74 and
75 .Fn isdigit_l ,
76 but may recognize additional characters, depending on the current locale
77 setting.
78 .Pp
79 The value of the argument must be representable as an
80 .Vt "unsigned char"
81 or the value of
82 .Dv EOF .
83 .Pp
84 The _l-suffixed versions take an explicit locale argument, whereas the
85 non-suffixed versions use the current global or per-thread locale.
86 .Sh RETURN VALUES
87 The
88 .Fn isdigit ,
89 .Fn isdigit_l ,
90 .Fn isnumber ,
91 and
92 .Fn isnumber_l
93 functions return zero if the character tests false and
94 return non-zero if the character tests true.
95 .Sh COMPATIBILITY
96 The
97 .Bx 4.4
98 extension of accepting arguments outside of the range of the
99 .Vt "unsigned char"
100 type in locales with large character sets is considered obsolete
101 and may not be supported in future releases.
102 The
103 .Fn iswdigit
104 or
105 .Fn iswdigit_l
106 function should be used instead.
107 .Sh SEE ALSO
108 .Xr ctype 3 ,
109 .Xr ctype_l 3 ,
110 .Xr iswdigit 3 ,
111 .Xr iswdigit_l 3 ,
112 .Xr multibyte 3 ,
113 .Xr xlocale 3 ,
114 .Xr ascii 7
115 .Sh STANDARDS
116 The
117 .Fn isdigit
118 function conforms to
119 .St -isoC .
120 The
121 .Fn isdigit_l
122 function conforms to
123 .St -p1003.1-2008 .
124 .Sh HISTORY
125 The
126 .Fn isnumber
127 function appeared in
128 .Bx 4.4 .