Skip to content

Kirby 5.3.0

Str::trim()

Trims away a fixed sequence at the beginning and end of the string. For character list trimming, use PHP's native trim() function.

Str::trim(string $string, string $trim = ' '): string

Parameters

Name Type Default
$stringrequired string no default value
$trim string ' '

Return type

string

Parent class

Kirby\Toolkit\Str

Examples

Str::trim('ababaCbabab', 'ab'); // 'aCb'