chickadee » srfi-13 » string-titlecase

(string-titlecase s [start end]) -> stringprocedure
(string-titlecase! s [start end]) -> unspecifiedprocedure

For every character C in the selected range of S, 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 parameter. string-titlecase! is the in-place side-effecting variant.

(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 if a START index is specified, then the character preceding S[START] has no effect on the titlecase decision for character S[START]:

(string-titlecase "greasy fried chicken" 2) => "Easy Fried Chicken"

Titlecase and cased information must be compatible with the Unicode specification.