Skip to content

Global Helpers

truncate()

truncate() — returns string

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

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

NameTypeRequiredDefaultDescription
textstringyesThe text to truncate.
lengthnumericno30Length to truncate the text to.
truncateStringstringno...String to replace the last characters with.
<!--- 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)")#