/** This is a sloppy and non-language-aware function to titlecase a string. That is, the first letter of each word is capitalized. It somewhat handles special Unicode characters. */ titlecase[str] := { wasLetter = false result = new array for c = chars[normalizeUnicode[str, "NFC"]] { isLetter = callJava["java.lang.Character", "isLetter", [c]] if isLetter and ! wasLetter result.push[callJava["java.lang.Character", "toTitleCase", [c]]] else result.push[c] wasLetter = isLetter } return char[result] }