Trim of all known UTF-8 whitespace types (or given chars) from beginning and ending of string
Like PHP’s trim() but works with multibyte strings and recognizes all types of UTF-8 whitespace as well as HTML whitespace entities. This method also optionally accepts an array for $chars argument which enables you to trim out string sequences greater than one character long.
If you do not need an extensive multibyte trim, use PHP’s trim() instead because this takes more overhead. PHP multibyte support (mb_string) is strongly recommended if using this function.
Available since version 3.0.124.
// basic usage $string = $sanitizer->trim(string $str); // usage with all arguments $string = $sanitizer->trim(string $str, $chars = '');
Characters to trim or omit (blank string) for all known whitespace (including UTF-8) and HTML-entity whitespace.
API reference based on ProcessWire core version 3.0.163