Next: , Previous: , Up: strings   [Index]


25.8 Case mapping

Function: %string-titlecase*! str start past
Macro: string-titlecase* s
Macro: string-titlecase*! s

For every character c in the selected range of str, if c is preceded by a cased character, it is downcased; otherwise it is titlecased.

string-titlecase* returns the result string and does not alter its s argument. string-titlecase! is the in–place side–effecting variant.

Examples:

(string-titlecase* "--capitalize tHIS sentence.")
⇒ "--Capitalize This Sentence."

(string-titlecase* "see Spot run. see Nix run.")
⇒ "See Spot Run. See Nix Run."

(string-titlecase* "3com makes routers.")
⇒ "3Com Makes Routers."

Note that the character preceding str[start] has no effect on the titlecase decision for character str[start]:

(string-titlecase* ("greasy fried chicken" 2))
⇒ "Easy Fried Chicken"
Macro: string-upcase* s
Macro: string-upcase*! s
Macro: string-downcase* s
Macro: string-downcase*! s

Raise or lower the case of the alphabetic characters in the string. There are no low level functions for these macros because they are just wrappers for %string-map and %string-map!.

string-upcase and string-downcase return the result string and do not alter their argument. string-upcase! and string-downcase! are the in–place side–effecting variants.