Global Helpers
hyphenize()
Signature
Section titled “Signature”hyphenize() — returns string
Available in: controller, model, test, mapper, migrator, migration, tabledefinition
Category: String Functions
Description
Section titled “Description”Converts camelCase or PascalCase strings into lowercase hyphen-separated strings. Useful for generating URL-friendly slugs, CSS class names, or readable identifiers.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
string | string | yes | — | The string to hyphenize. |
Examples
Section titled “Examples”1. Basic camelCase string
#hyphenize("myBlogPost")#
// Output:
// my-blog-post
2. PascalCase string
#hyphenize("UserProfileSettings")#
// Output:
// user-profile-settings
3. Single word (no change)
#hyphenize("Dashboard")#
// Output:
// dashboard
4. Already hyphenated string (stays lowercase)
#hyphenize("already-hyphenized")#
// Output:
// already-hyphenized