Wraps text so that each line has a specified maximum number of characters.
wrap(String, limit [, strip])
returns string
Name | Type | Required | Default | Description |
---|---|---|---|---|
String | string | Yes | String or variable that contains one. The text to wrap. | |
limit | numeric | Yes | Positive integer maximum number of characters to allow on a line. |
|
strip | boolean | No | NO | Whether to remove all existing newline and carriage return characters in the input string with spaces before wrapping the text. Default: False. |
sentence = "This is a standard sentence.";
wrappedSentence = wrap(sentence, 7);
writeOutput(wrappedSentence);
<cfset sentence = "This is a standard sentence." />
<cfset wrappedSentence = wrap(sentence, 7) />
<cfoutput>#wrappedSentence#</cfoutput>