src/Util/Strings.php
public static function trim(string $s, string $charList = self::TRIM_CHARACTERS): string
    {
        $charList = \preg_quote($charList, '#');

        return static::replace($s, '#^[' . $charList . ']+|[' . $charList . ']+\z#u', '');
    }
public static function trim(string $s, string $charList = self::TRIM_CHARACTERS): string
    {
        $charList = \preg_quote($charList, '#');

        return static::replace($s, '#^[' . $charList . ']+|[' . $charList . ']+\z#u', '');
    }
public static function trim ( string $ s , string $ charList = self :: TRIM_CHARACTERS ) : string { $ charList = \ preg_quote ( $ charList , '#' ) ; return static :: replace ( $ s , '#^[' . $ charList . ']+|[' . $ charList . ']+\z#u' , '' ) ; }
Strips whitespace.

@param  string $s UTF-8 encoding
@param  string $charList

@return string
@throws RegexpException
Strips whitespace .