Function string-upcase, string-downcase, string-capitalize, nstring-upcase, nstring-downcase, nstring-capitalize

Syntax:

string-upcase string &key start end cased-string

string-downcase string &key start end cased-string

string-capitalize string &key start end cased-string

nstring-upcase string &key start end string

nstring-downcase string &key start end string

nstring-capitalize string &key start end string

Arguments and Values:

string—a string designator. For nstring-upcase, nstring-downcase, and nstring-capitalize, the string designator must be a string.

start, endbounding index designators of string. The defaults for start and end are 0 and nil, respectively.

18.3.0 13cased-string—a string.

Description:

string-upcase, string-downcase, string-capitalize, nstring-upcase, nstring-downcase, nstring-capitalize change the case of the subsequence of string bounded by start and end as follows:

Barrett: Duplication \param{start} marks the beginning position of the substring. \param{end} marks the position following the last element of the substring.

18.3.0 9For string-upcase, string-downcase, and string-capitalize, string is not modified. However, if no characters in string require conversion, the result may be either string or a copy of it, at the implementation's discretion.

Implied by use of "string designator". \issue{STRING-COERCION:MAKE-CONSISTENT} \funref{string-upcase}, \funref{string-downcase}, and \funref{string-capitalize} perform coercion identical to the action of \funref{string}. \endissue{STRING-COERCION:MAKE-CONSISTENT}

Examples:

 (string-upcase "abcde") → "ABCDE"
 (string-upcase "Dr. Livingston, I presume?")
→ "DR. LIVINGSTON, I PRESUME?"
 (string-upcase "Dr. Livingston, I presume?" :start 6 :end 10)
→ "Dr. LiVINGston, I presume?"
 (string-downcase "Dr. Livingston, I presume?")
→ "dr. livingston, i presume?"

 (string-capitalize "elm 13c arthur;fig don't") → "Elm 13c Arthur;Fig Don'T"
 (string-capitalize " hello ") → " Hello "
 (string-capitalize "occlUDeD cASEmenTs FOreSTAll iNADVertent DEFenestraTION")
→  "Occluded Casements Forestall Inadvertent Defenestration"
 (string-capitalize 'kludgy-hash-search) → "Kludgy-Hash-Search"
 (string-capitalize "DON'T!") → "Don'T!"    ;not "Don't!"
 (string-capitalize "pipe 13a, foo16c") → "Pipe 13a, Foo16c"

 (setq str (copy-seq "0123ABCD890a")) → "0123ABCD890a"
 (nstring-downcase str :start 5 :end 7) → "0123AbcD890a"
 str → "0123AbcD890a"

Side Effects:

nstring-upcase, nstring-downcase, and nstring-capitalize modify string as appropriate rather than constructing a new string.

Affected By:

None.

Exceptional Situations:

None.

See Also:

char-upcase, char-downcase

Notes:

18.3.0 8The result is always of the same length as string.