Skip to content

Global Helpers

wordTruncate()

wordTruncate() — returns string

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

Truncates text to the specified length of words and replaces the remaining characters with the specified truncate string (which defaults to ”…”).

NameTypeRequiredDefaultDescription
textstringyesThe text to truncate.
lengthnumericno5Number of words to truncate the text to.
truncateStringstringno...String to replace the last characters with.
<!--- Outputs "CFWheels is a framework..." --->
#wordTruncate(text="CFWheels is a framework for ColdFusion", length=4)#