Global Helpers
humanize()
Signature
Section titled “Signature”humanize() — returns string
Available in: controller, model, mapper, migrator, migration, tabledefinition
Category: String Functions
Description
Section titled “Description”Returns readable text by capitalizing and converting camel casing to multiple words.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
text | string | yes | — | Text to humanize. |
except | string | no | — | A list of strings (space separated) to replace within the output. |
Examples
Section titled “Examples”// 1. Humanize a camelCase string
result = humanize("wheelsIsAFramework");
// result -> "Wheels Is A Framework"
// 2. Humanize a string and replace an abbreviation using the except argument
result = humanize("wheelsIsACfmlFramework", "CFML");
// result -> "Wheels Is A CFML Framework"
// 3. Humanize a multi-word property name from a model attribute
result = humanize("firstName");
// result -> "First Name"