wpseek.com
WordPress开发者和主题制作者的搜索引擎



normalize_whitespace › WordPress Function

Since2.7.0
已弃用n/a
normalize_whitespace ( $str )
参数:
  • (string) $str The string to normalize.
    Required: Yes
返回:
  • (string) The normalized string.
定义在:
文档:

Normalizes EOL characters and strips duplicate whitespace.



源码

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