TextUtils
in package
Text utils class.
Table of Contents
- getTagAttributes() : array<string|int, string>
- Get all attributes of a tag.
- getTextLength() : int
- Get text length.
- htmlTruncate() : string
- Truncating HTML.
- htmlTruncateByWords() : string
- Truncating HTML by words.
- textTruncate() : string
- Truncating text.
Methods
getTagAttributes()
Get all attributes of a tag.
public
static getTagAttributes(string $tag) : array<string|int, string>
Parameters
- $tag : string
Return values
array<string|int, string> —getTextLength()
Get text length.
public
static getTextLength(string $text) : int
Parameters
- $text : string
Return values
int —htmlTruncate()
Truncating HTML.
public
static htmlTruncate(string $html[, int $length = 255 ][, string $ending = '...' ]) : string
Parameters
- $html : string
- $length : int = 255
- $ending : string = '...'
Return values
string —htmlTruncateByWords()
Truncating HTML by words.
public
static htmlTruncateByWords(string $html, int $length[, string $ending = '...' ]) : string
Parameters
- $html : string
- $length : int
- $ending : string = '...'
Return values
string —textTruncate()
Truncating text.
public
static textTruncate(string $text[, bool|int $length = false ][, bool $addDots = true ]) : string
Parameters
- $text : string
- $length : bool|int = false
- $addDots : bool = true