Global Helpers
truncate()
Signature
Section titled “Signature”truncate() — returns string
Available in: controller, model, test, migrator, migration, tabledefinition
Category: String Functions
Description
Section titled “Description”Truncates text to the specified length and replaces the last characters with the specified truncate string (which defaults to ”…”).
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
text | string | yes | — | The text to truncate. |
length | numeric | no | 30 | Length to truncate the text to. |
truncateString | string | no | ... | String to replace the last characters with. |
Examples
Section titled “Examples”<!--- Will output: CFWheels is a fra... --->
#truncate(text="CFWheels is a framework for ColdFusion", length=20)#
<!--- Will output: CFWheels is a framework (more) --->
#truncate(text="CFWheels is a framework for ColdFusion", truncateString=" (more)")#