Stringy\Stringy::trim PHP Method

trim() public method

Returns a string with whitespace removed from the start and end of the string. Supports the removal of unicode whitespace. Accepts an optional string of characters to strip instead of the defaults.
public trim ( string $chars = null ) : Stringy
$chars string Optional string of characters to strip
return Stringy Object with a trimmed $str
    public function trim($chars = null)
    {
        $chars = $chars ? preg_quote($chars) : '[:space:]';
        return $this->regexReplace("^[{$chars}]+|[{$chars}]+\$", '');
    }