normalize_whitespace()

最后更新于:2021-11-27 17:55:24

normalize_whitespace( string$str)

Normalize EOL characters and strip duplicate whitespace.

参数

$str

(string) (Required) The string to normalize.

响应

(string) The normalized string.

源文件

文件: gc-includes/formatting.php

function normalize_whitespace( $str ) {
	$str = trim( $str );
	$str = str_replace( "r", "n", $str );
	$str = preg_replace( array( '/n+/', '/[ t]+/' ), array( "n", ' ' ), $str );
	return $str;
}