PO::trim_quotes() WordPress Method
The PO::trim_quotes() method is used to remove leading and trailing white-space from a string, as well as any quotes that may be surrounding the string. This is often useful when dealing with user-inputted data, as it can help to ensure that the data is clean and free of any unwanted characters.
PO::trim_quotes( string $s ) #
Contents
Parameters
- $s
(string)(Required)
Return
(string)
Source
File: wp-includes/pomo/po.php
public static function trim_quotes( $s ) {
if ( '"' === substr( $s, 0, 1 ) ) {
$s = substr( $s, 1 );
}
if ( '"' === substr( $s, -1, 1 ) ) {
$s = substr( $s, 0, -1 );
}
return $s;
}
Expand full source codeCollapse full source codeView on TracView on GitHub