Document the isnumber() and ishexnumber() functions, and explain how they

differ (at least in theory) from isdigit() and isxdigit().
This commit is contained in:
Tim J. Robbins 2004-03-30 07:02:04 +00:00
parent dd1c7d1373
commit ba6699086d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=127606
2 changed files with 34 additions and 13 deletions

View file

@ -36,7 +36,7 @@
.\" @(#)isdigit.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
.Dd October 6, 2002
.Dd March 30, 2004
.Dt ISDIGIT 3
.Os
.Sh NAME
@ -53,15 +53,21 @@
.Sh DESCRIPTION
The
.Fn isdigit
function tests for any decimal-digit character.
For any locale,
this includes the following characters only:
function tests for a decimal digit character.
Regardless of locale, this includes the following characters only:
.Pp
.Bl -column \&``0''______ \&``0''______ \&``0''______ \&``0''______ \&``0''______
.It "\&``0''\t``1''\t``2''\t``3''\t``4''"
.It "\&``5''\t``6''\t``7''\t``8''\t``9''"
.El
.Pp
The
.Fn isnumber
function behaves similarly to
.Fn isdigit ,
but may recognize additional characters, depending on the current locale
setting.
.Pp
For single C
.Va char Ns s
locales (see
@ -74,7 +80,9 @@ or the value of
.Sh RETURN VALUES
The
.Fn isdigit
function returns zero if the character tests false and
and
.Fn isnumber
functions return zero if the character tests false and
returns non-zero if the character tests true.
.Sh COMPATIBILITY
Although
@ -97,3 +105,8 @@ The
.Fn isdigit
function conforms to
.St -isoC .
.Sh HISTORY
The
.Fn isnumber
function appeared in
.Bx 4.4 .

View file

@ -36,7 +36,7 @@
.\" @(#)isxdigit.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
.Dd October 6, 2002
.Dd March 30, 2004
.Dt ISXDIGIT 3
.Os
.Sh NAME
@ -54,7 +54,7 @@
The
.Fn isxdigit
function tests for any hexadecimal-digit character.
For any locale, this includes the following characters only:
Regardless of locale, this includes the following characters only:
.Pp
.Bl -column \&``0''______ \&``0''______ \&``0''______ \&``0''______ \&``0''______
.It "\&``0''\t``1''\t``2''\t``3''\t``4''"
@ -64,6 +64,13 @@ For any locale, this includes the following characters only:
.It "\&``e''\t``f''"
.El
.Pp
The
.Fn ishexnumber
function behaves similarly to
.Fn isxdigit ,
but may recognize additional characters,
depennding on the current locale setting.
.Pp
For single C
.Va char Ns s
locales (see
@ -81,18 +88,14 @@ returns non-zero if the character tests true.
.Sh COMPATIBILITY
Although
.Fn isxdigit
and
.Fn ishexnumber
accept arguments outside of the range of the
accepts arguments outside of the range of the
.Vt "unsigned char"
type in locales with large character sets,
this is a
.Bx 4.4
extension and the
.Fn isxwdigit
and
.Fn iswhexnumber
functions should be used instead for maximum portability.
function should be used instead for maximum portability.
.Sh SEE ALSO
.Xr ctype 3 ,
.Xr iswxdigit 3 ,
@ -103,3 +106,8 @@ The
.Fn isxdigit
function conforms to
.St -isoC .
.Sh HISTORY
The
.Fn ishexnumber
function appeared in
.Bx 4.4 .