char-upcase(3scm)
π NAME π
okay bestie, welcome to the char-upcase(3scm) page from the Scheme Programmer's Manual β this one is all about char-upcase, char-downcase, char-foldcase, and char-titlecase, aka case conversion π
β¨
π LIBRARY π
lowkey here are the imports you need:
(import (rnrs)) ;R6RS
(import (rnrs unicode)) ;R6RS
(import (scheme r5rs)) ;R7RS
(import (scheme char)) ;R7RS
β¨ SYNOPSIS β¨
(char-upcase char)
(char-downcase char)
(char-foldcase char)
(char-titlecase char) ;R6RS
π¦ DESCRIPTION π¦
okay so these procedures take a character argument and return a character result β no cap, that's the whole vibe π«Ά
char-downcaseβ if the argument is an upper-case or title-case character, and if there's a single character that is its lower-case form, thenchar-downcasereturns that character.char-upcaseβ if the argument is a lower-case or title-case character, and if there's a single character that is its upper-case form, thenchar-upcasereturns that character.char-foldcaseβ if the character has a case-folded character, thenchar-foldcasereturns that character. Otherwise the character returned is the same as the argument. For Turkic characters IΜ (#\x130) and Δ± (#\x131),char-foldcasebehaves as the identity function; otherwisechar-foldcaseis the same aschar-downcasecomposed withchar-upcase.char-titlecaseβ if the argument is a lower-case or upper-case character, and there's a single character that is its title-case form, thenchar-titlecasereturns that character. If the argument is not a title-case character and there's no single character that is its title-case form, thenchar-titlecasereturns the upper-case form of the argument.
R7RS notes that language-sensitive folding and casing pairs are not used. π
π RETURN VALUES π
Returns a single character object. periodt π
π₯ EXAMPLES π₯
here's the vibe check, bestie:
(char-upcase #\i) => #\I
(char-downcase #\i) => #\i
(char-titlecase #\i) => #\I
(char-foldcase #\i) => #\i
;; The following might not be supported in R7RS implementations.
(char-upcase #\Γ) => #\Γ
(char-downcase #\Γ) => #\Γ
(char-titlecase #\Γ) => #\Γ
(char-foldcase #\Γ) => #\Γ
(char-upcase #\Ξ£) => #\Ξ£
(char-downcase #\Ξ£) => #\Ο
(char-titlecase #\Ξ£) => #\Ξ£
(char-foldcase #\Ξ£) => #\Ο
(char-upcase #\Ο) => #\Ξ£
(char-downcase #\Ο) => #\Ο
(char-titlecase #\Ο) => #\Ξ£
(char-foldcase #\Ο) => #\Ο
π COMPATIBILITY π
R5RS and earlier reports do not have char-foldcase and char-titlecase. R7RS does not have char-titlecase. R7RS implementations may or may not support Unicode, but they are required to support ASCII.
In R6RS implementations and other implementations that support Unicode, the behavior of these procedures depends on the supported Unicode version.
π 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-upper-case?(3scm), char-lower-case?(3scm) β go check those besties too π«Ά
π STANDARDS π
R4RS, IEEE Scheme, R5RS, R6RS, R7RS
πΈ HISTORY πΈ
R5RS and earlier reports make no provisions for Unicode. ASCII is mentioned but implementations may even run on EBCDIC. Implementations of R5RS may support Unicode, but historically many implementations used ISO-8859-n and other character sets which are now subsets of Unicode.
π§ 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/.
xoxo, your fav Unix bestie π β signing off from the char-upcase(3scm) page, dated 2021-02-21 πβ¨
π¦ 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