Next: , Previous: Type Coercion, Up: Procedures

7.3.2 String-Case

(require 'string-case)

— Procedure: string-upcase str
— Procedure: string-downcase str
— Procedure: string-capitalize str

The obvious string conversion routines. These are non-destructive.

— Function: string-upcase! str
— Function: string-downcase! str
— Function: string-capitalize! str

The destructive versions of the functions above.

— Function: string-ci->symbol str

Converts string str to a symbol having the same case as if the symbol had been read.

— Function: symbol-append obj1 ...

Converts obj1 ... to strings, appends them, and converts to a symbol which is returned. Strings and numbers are converted to read's symbol case; the case of symbol characters is not changed. #f is converted to the empty string (symbol).

— Function: StudlyCapsExpand str delimiter
— Function: StudlyCapsExpand str

delimiter must be a string or character. If absent, delimiter defaults to ‘-’. StudlyCapsExpand returns a copy of str where delimiter is inserted between each lower-case character immediately followed by an upper-case character; and between two upper-case characters immediately followed by a lower-case character.

          (StudlyCapsExpand "aX" " ")   ⇒ "a X"
          (StudlyCapsExpand "aX" "..")  ⇒ "a..X"
          (StudlyCapsExpand "AX")       ⇒ "AX"
          (StudlyCapsExpand "Ax")       ⇒ "Ax"
          (StudlyCapsExpand "AXLE")     ⇒ "AXLE"
          (StudlyCapsExpand "aAXACz")   ⇒ "a-AXA-Cz"
          (StudlyCapsExpand "AaXACz")   ⇒ "Aa-XA-Cz"
          (StudlyCapsExpand "AAaXACz")  ⇒ "A-Aa-XA-Cz"
          (StudlyCapsExpand "AAaXAC")   ⇒ "A-Aa-XAC"