src/Data/String.php
public static function truncate($pStr, $pLimit, $pEnd = '...')
    {
        $str    = strip_tags($pStr);
        $length = mb_strlen($str);
        if ($length <= $pLimit) {
            return $str;
        }

        return trim(mb_substr($str, 0, $pLimit)) . $pEnd;
    }
public static function truncate($pStr, $pLimit, $pEnd = '...')
    {
        $str    = strip_tags($pStr);
        $length = mb_strlen($str);
        if ($length <= $pLimit) {
            return $str;
        }

        return trim(mb_substr($str, 0, $pLimit)) . $pEnd;
    }
public static function truncate ( $ pStr , $ pLimit , $ pEnd = '...' ) { $ str = strip_tags ( $ pStr ) ; $ length = mb_strlen ( $ str ) ; if ( $ length <= $ pLimit ) { return $ str ; } return trim ( mb_substr ( $ str , 0 , $ pLimit ) ) . $ pEnd ; }
Truncate a string and add an optional suffix.

@param string $pStr String to truncate
@param int $pLimit Length of the string to return
@param string $pEnd Suffix
Truncate a string and add an optional suffix .