String.limit
limit($numCharacters, $ending = '...')
Description
If the string length is larger than numCharacters
, truncate the string and append ending
.
Common punctuation characters will be trimmed from the end before ending
is added.
$longString = 'This is a moderately long phrase.'; $longString.limit(20); //= 'This is a moderately...';