/** * Shorten a string to a given number of characters. * * The function preserves words, so the result might be a bit shorter or * longer than the number of characters given. It strips all tags. * * @param string $strString The string to shorten. * @param integer $intNumberOfChars The target number of characters. * @param string $strEllipsis An optional ellipsis to append to the shortened string. * * @return string The shortened string */ public static function substr($strString, $intNumberOfChars, $strEllipsis = ' …') { if (self::isStringUtilAvailable()) { return StringUtil::substr($strString, $intNumberOfChars, $strEllipsis); } return \Contao\String::substr($strString, $intNumberOfChars, $strEllipsis); }