Smartsite SXML CopyCode image Copy Code
<se:text save="mytext">
Yes. This is a short story. This is short story about how string.truncate works. It right trims sentences up to a given length, attempting to use word boundaries to the a nice looking substring.
</se:text>

{string.length(string.truncate($mytext, 5))} {string.truncate($mytext, 5)}
{string.length(string.truncate($mytext, 20))} {string.truncate($mytext, 20)}
{string.length(string.truncate($mytext, 50))} {string.truncate($mytext, 50)}
Example Result CopyCode image Copy Code
7 Yes....
23 Yes. This is a short...
50 Yes. This is a short story. This is short story...
SXML