Raymond Toy pushed to branch issue-326-char-casing-cleanup at cmucl / cmucl
Commits:
-
41270e6b
by Raymond Toy at 2024-06-03T19:46:29-07:00
1 changed file:
Changes:
... | ... | @@ -401,15 +401,11 @@ |
401 | 401 | (defun char-titlecase (char)
|
402 | 402 | "Returns CHAR converted to title-case if that is possible."
|
403 | 403 | (declare (character char))
|
404 | - #-(and unicode (not unicode-bootstrap))
|
|
405 | - (if (lower-case-p char)
|
|
406 | - (code-char (- (char-code char) 32))
|
|
407 | - char)
|
|
408 | - #+(and unicode (not unicode-bootstrap))
|
|
409 | 404 | (let ((m (char-code char)))
|
410 | - (cond ((> m +ascii-limit+) (code-char (unicode-title m)))
|
|
411 | - ((< (char-code #\`) m (char-code #\{))
|
|
412 | - (code-char (- m 32)))
|
|
405 | + (cond ((<= (char-code #\a) m (char-code #\z))
|
|
406 | + (code-char (logxor m #x20)))
|
|
407 | + #+(and unicode (not unicode-bootstrap))
|
|
408 | + ((> m +ascii-limit+) (code-char (unicode-title m)))
|
|
413 | 409 | (t char))))
|
414 | 410 | |
415 | 411 | (defun title-case-p (char)
|
... | ... | @@ -417,7 +413,7 @@ |
417 | 413 | argument is a title-case character, NIL otherwise."
|
418 | 414 | (declare (character char))
|
419 | 415 | (let ((m (char-code char)))
|
420 | - (or (< 64 m 91)
|
|
416 | + (or (<= (code-char #\A) m (code-char #\Z))
|
|
421 | 417 | #+(and unicode (not unicode-bootstrap))
|
422 | 418 | (and (> m +ascii-limit+)
|
423 | 419 | (= (unicode-category m) +unicode-category-title+)))))
|