Remove white space or a specific set of characters from the beginning and/or end of the string.
Twine\Str::trim( [ string $mask = " \t\n\r\0\x0B" [, string $mode = Config\Trim::BOTH ]] ) : Twine\Str
Parameters
$mask
|
A list of characters to be stripped
|
$mode
|
A trim mode flag
|
Available trim modes:
Twine\Config\Trim::BOTH
|
Trim characters from the beginning and end of the string
|
Twine\Config\Trim::LEFT
|
Only trim characters from the beginning of the string
|
Twine\Config\Trim::RIGHT
|
Only trim characters from the end of the string
|
Examples
$string = new Twine\Str(' john pinkerton ');
$string->trim();
$string->trim(Twine\Config\Trim::LEFT);
$string->trim(Twine\Config\Trim::RIGHT);
$string = new Twine\Str('john pinkerton');
$string->trim('jton');
$string = new Twine\Str(' john pinkerton ');
$string->trimLeft();
$string = new Twine\Str(' john pinkerton ');
$string->trimRight();
Aliases
Twine\Str::trimLeft($mask)
|
= |
Twine\Str::trim($mask, Twine\Config\Trim::LEFT)
|
Twine\Str::trimRight($mask)
|
= |
Twine\Str::trim($mask, Twine\Config\Trim::RIGHT)
|