str::excerpt

Creates an excerpt of a string It removes all html tags first and then uses str::short

str::excerpt($string, $chars = 140, $removehtml = true, $rep = '…')

Parameters

$string (string)
The string to be shortened
$chars (int)
The final number of characters the string should have
$removehtml (boolean)
True: remove the HTML tags from the string first
$rep (string)
The element, which should be added if the string is too long. Ellipsis is the default.

Return values

string
The shortened string