Some characters can be described as being uppercase or lowercase and there are functions that operate on strings and characters to detect the case, convert between the cases and compare while igoring the case.
The Common Lisp functions in LispWorks handle case in characters based on the foldings as defined in Unicode 15.0.0 (the simple folding), provided they can be made to obey the ANSI Common Lisp standard's requirement that cased characters are always in one-to-one pairs of uppercase and lowercase characters. The Unicode simple folding largely matches this requirement, except for 30 characters. For these 30 characters, the specified folding target is a lowercase character that is paired with a more useful uppercase character. For example, the Kelvin symbol (code #x212a) is supposed to fold to lowercase 'k', which is obviously paired with uppercase 'K' in Common Lisp. LispWorks ignores these foldings in the Common Lisp functions.
For case-insensitive comparison functions, characters are folded according to the Unicode specification, which means that most characters are downcased, but some are upcased. Note that, prior to LispWorks 8.1, characters were always upcased for case-insensitive comparison functions. That does not change the resuls of equality functions, but it does change the results of ordering functions (such as string-lessp and char-greaterp).
There are two lowercase characters of type base-char (code 223 "small sharp s" and code 255 "small y with diaeresis") that have corresponding uppercase characters that are not of type base-char (codes #x1e9e and #x178). This means that upcasing may introduce non base-char characters even if coming from only base-char characters. Most significantly, if the functions nstring-upcase and nstring-capitalize are given a base-string and need to upcase either of these characters, they cannot do it and will signal an error. The non-destructive functions string-upcase and string-capitalize create a text-string in this case. This may cause unexpected errors if the result is assumed to be a base-string, for example is written to a stream with element type base-char.
LispWorks also has functions that follow the full Unicode simple folding specification for string or character comparison and predicates (but not case modifiying). See 26.4.2 Functions to handle characters with case using Unicode rules for more details.
This section lists functions which compare characters and strings similarly to cl:char-equal, cl:string-greaterp and so on, but which use Unicode's simple case folding rules.
There are also predicates for properties of characters in Unicode's "general category", corresponding to cl:alpha-char-p, cl:both-case-p and so on.
The functions unicode-char-equal, unicode-char-not-equal, unicode-char-lessp, unicode-char-not-lessp, unicode-char-greaterp and unicode-char-not-greaterp compare characters similarly to cl:char-equal etc, but using Unicode's simple case folding rules.
The functions unicode-string-equal, unicode-string-not-equal, unicode-string-lessp, unicode-string-not-lessp, unicode-string-greaterp and unicode-string-not-greaterp compare strings similarly to cl:string-equal etc, but using Unicode's simple case folding rules.
The predicates unicode-alphanumericp, unicode-alpha-char-p, unicode-lower-case-p, unicode-upper-case-p and unicode-both-case-p test for properties of a character in Unicode's "general category". Note that unicode-lower-case-p, unicode-upper-case-p and unicode-both-case-p differ from the corresponding Common Lisp functions, which only return true for characters with one-to-one pairs of uppercase and lowercase.
LispWorks® User Guide and Reference Manual - 18 Feb 2025 15:32:07