Goto main content

wordwrap

Wraps a string to a given number of characters.

WORDWRAP

NAME

wordwrap - Wraps a string to a given number of characters.

SYNOPSIS

wordwrap(string,width,break,cut)

PARAMETERS

string
The input string.
width
The column width.
break
The line is broken using the optional break parameter.
cut
If the cut is set to TRUE, the string is always wrapped at or before the specified width. So if you have a word that is larger than the given width, it is broken apart.

RETURN

Returns the given string wrapped at the specified column.

EXAMPLES

in:  res=<{wordwrap("ààaaaÓ привет Pierre",2,"\n")}>.
out: res=ààaaaÓ
привет
Pierre").

in:  res=<{wordwrap("ààaaaÓ 1234 5 hello",2,"<br />\n",true)}>.
out: res=àà<br />
aa<br />
aÓ<br />
 <br />
12<br />
34<br />
 <br />
5 <br />
he<br />
ll<br />
o").

in:  res=<{wordwrap("12345",2,"<br />\n")}>.
out: res=-1.

SEE ALSO

{{ include("includes/strings.sn") }}

AUTHOR

Written by Pusnei Sergey, <sergey@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

Edit

© 2024 extenso Inc. All rights reserved.