Method: str::short

Shortens a string and adds an ellipsis if the string is too long

Info

Syntax

str::short($string, $chars, $rep='…')

Parameters

Return (string)

The shortened string

Example


echo str::short('This is a very, very, very long string', 10);
// output: This is a…

echo str::short('This is a very, very, very long string', 10, '####');
// output: This i####