‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Text\TextCropper Class Reference

Public Member Functions

string crop (string $content, int $numberOfChars, string $replacementForEllipsis, bool $cropToSpace)

Detailed Description

Definition at line 20 of file TextCropper.php.

Member Function Documentation

◆ crop()

string TYPO3\CMS\Core\Text\TextCropper::crop ( string  $content,
int  $numberOfChars,
string  $replacementForEllipsis,
bool  $cropToSpace 

Implements "cropHTML" which is a modified "substr" function allowing to limit a string length to a certain number of chars (from either start or end of string) and having a pre/postfix applied if the string really was cropped.

Note: Crop is done without properly respecting html tags and entities.

string$content‪The string to perform the operation on
int$numberOfChars‪Max number of chars of the string. Negative value means cropping from end of string.
string$replacementForEllipsis‪The pre/postfix string to apply if cropping occurs.
bool$cropToSpace‪If true then crop will be applied at nearest space.
‪string The processed input value.

Definition at line 34 of file TextCropper.php.