Download or view titlecase.frink in plain text format
/** 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]
}
Download or view titlecase.frink in plain text format
This is a program written in the programming language Frink.
For more information, view the Frink
Documentation or see More Sample Frink Programs.
Alan Eliasen, eliasen@mindspring.com