ToC DocOverview CGDoc RelNotes Index PermutedIndex
Allegro CL
Home Previous Up Next Table of Contents Index
  ANSI Common Lisp   22 Printer   22.3 Formatted Output   22.3.8 FORMAT Miscellaneous Operations

22.3.8.1 Tilde Left-Paren: Case Conversion

~(str~)

The contained control string str is processed, and what it produces is subject to case conversion.

With no flags, every uppercase character is converted to the corresponding lowercase character.

~:( capitalizes all words, as if by string-capitalize.

~@( capitalizes just the first word and forces the rest to lower case.

~:@( converts every lowercase character to the corresponding uppercase character.

In this example ~@( is used to cause the first word produced by ~@R to be capitalized:

 (format nil "~@R ~(~@R~)" 14 14) 
 "XIV xiv"
 (defun f (n) (format nil "~@(~R~) error~:P detected." n))   F
 (f 0)  "Zero errors detected."
 (f 1)  "One error detected."
 (f 23)  "Twenty-three errors detected."

When case conversions appear nested, the outer conversion dominates, as illustrated in the following example:

 (format nil "~@(how is ~:(BOB SMITH~)?~)")
  "How is bob smith?"
 NOT"How is Bob Smith?"

Home Previous Up Next Table of Contents Index
© Franz Inc. 1998-2019 - File last updated 02-07-2019