Skip to content

Global Helpers

hyphenize()

hyphenize() — returns string

Available in: controller, model, test, mapper, migrator, migration, tabledefinition Category: String Functions

Converts camelCase or PascalCase strings into lowercase hyphen-separated strings. Useful for generating URL-friendly slugs, CSS class names, or readable identifiers.

NameTypeRequiredDefaultDescription
stringstringyesThe string to hyphenize.
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