char-alphabetic?(3scm)
π char-alphabetic?, char-numeric?, etc β test character properties π
bestie, welcome to the char-alphabetic?(3scm) page from the Scheme Programmer's Manual. it is literally all about testing character properties, and we are keeping every single detail because that's the whole vibe. π
β¨ NAME β¨
char-alphabetic?, char-numeric?, etc. β these cuties test character properties. that's the name, that's the game. π«Ά
π LIBRARY π
okay so import these depending on your flavor:
(import (rnrs)) ;R6RS
(import (rnrs unicode)) ;R6RS
(import (scheme r5rs)) ;R7RS
(import (scheme char)) ;R7RS
πΈ SYNOPSIS πΈ
the procedure shapes are giving exactly this:
(char-alphabetic? char)
(char-numeric? char)
(char-whitespace? char)
(char-upper-case? char)
(char-lower-case? char)
(char-title-case? char) ;R6RS
π DESCRIPTION π
okay so these procedures return #t if their arguments are alphabetic, numeric, whitespace, upper-case, lower-case, or title-case characters, respectively; otherwise they return #f. iconic boolean behavior, no cap.
here's the breakdown, bestie:
- A character is alphabetic if it has the Unicode
"Alphabetic"property. - A character is numeric if it has the Unicode
"Numeric"property. - A character is whitespace if it has the Unicode
"White_Space"property. - A character is upper case if it has the Unicode
"Uppercase"property. - A character is lower case if it has the
"Lowercase"property. - A character is title case if it is in the
Ltgeneral category.
R7RS notes that char-numeric? tests for "Numeric_Type=Decimal". Either way, it checks if the character is a decimal number. fr fr, decimal-coded.
π¦ RETURN VALUES π¦
Returns a single boolean value. one value, one destiny. β¨
π EXAMPLES π
(char-alphabetic? #\a) => #t
(char-numeric? #\1) => #t
(char-whitespace? #\space) => #t
;; The following are not required to be supported in R7RS.
(char-numeric? #\x096A) => #t
(char-whitespace? #\x00A0) => #t
(char-upper-case? #\Ξ£) => #t
(char-lower-case? #\Ο) => #t
π COMPATIBILITY π
Compatibility in R7RS systems depends on the implementation's supported character set. In systems that support Unicode, these procedures return different results depending on the supported Unicode version.
R5RS and earlier reports mention the proper semantics for ASCII, but implementations are free to use e.g. EBCDIC instead. yes, EBCDIC said hi. π
π ERRORS π
This procedure can raise exceptions with the following condition types:
&assertion(R6RS) β the wrong number of arguments was passed or an argument was outside its domain.- R7RS β the assertions described above are errors. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically.
π SEE ALSO π
char->integer(3scm) β go see it, bestie. π«Ά
β STANDARDS β
R4RS, IEEE Scheme, R5RS, R6RS, R7RS. standards-coded and thriving.
π§ AUTHORS π§
This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://github.com/schemedoc/manpages/.
okay bestie, that's the page. cute little footer sign-off: 2021-02-20, for char-alphabetic?(3scm). stay boolean and stay slay. π
π¦ where this page comes from
- nixpkgs unstable: scheme-manpages 0-unstable-2024-02-11
- π the page's license: MIT
- Copyright (c) 2021 Gwen Weinholt
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms