src/Sulu/Component/Util/TextUtils.php
public static function truncate($text, $length, $suffix = '...')
    {
        $strlen = mb_strlen($text, 'UTF-8');

        if ($strlen > $length) {
            $truncatedLength = $length - strlen($suffix);
            $text = mb_substr($text, 0, $truncatedLength, 'UTF-8') . $suffix;
        }

        return $text;
    }
public static function truncate($text, $length, $suffix = '...')
    {
        $strlen = mb_strlen($text, 'UTF-8');

        if ($strlen > $length) {
            $truncatedLength = $length - strlen($suffix);
            $text = mb_substr($text, 0, $truncatedLength, 'UTF-8') . $suffix;
        }

        return $text;
    }
public static function truncate ( $ text , $ length , $ suffix = '...' ) { $ strlen = mb_strlen ( $ text , 'UTF-8' ) ; if ( $ strlen > $ length ) { $ truncatedLength = $ length - strlen ( $ suffix ) ; $ text = mb_substr ( $ text , 0 , $ truncatedLength , 'UTF-8' ) . $ suffix ; } return $ text ; }
UTF-8 safe text truncation.

@param string $text - Text to truncate
@param int $length - Length to truncate to
@param string $suffix - This string will replace the last characters of the text

@return string
UTF - 8 safe text truncation .