Global Helpers
titleize()
Signature
Section titled “Signature”titleize() — returns string
Available in: controller, model, mapper, migrator, migration, tabledefinition
Category: String Functions
Description
Section titled “Description”Capitalizes all words in the text to create a nicer looking title.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
word | string | yes | — | The text to turn into a title. |
Examples
Section titled “Examples”// 1. Capitalize each word in a plain sentence
result = titleize("the quick brown fox");
// result -> "The Quick Brown Fox"
// 2. Capitalize a page title that is already mixed case
result = titleize("CFWheels is a framework for ColdFusion");
// result -> "CFWheels Is A Framework For ColdFusion"
// 3. Use titleize to format a record name for display
article = model("Article").findByKey(params.key);
writeOutput(titleize(article.title));