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 ) #


Parameters

$s

(string)(Required)


Top ↑

Return

(string)


Top ↑

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;
		}

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.