WP_Text_Diff_Renderer_inline::_splitOnWords()publicWP 2.6.0

Method of the class: WP_Text_Diff_Renderer_inline{}

No Hooks.

Return

String.

Usage

$WP_Text_Diff_Renderer_inline = new WP_Text_Diff_Renderer_inline();
$WP_Text_Diff_Renderer_inline->_splitOnWords( $string, $newlineEscape );
$string(string) (required)
-
$newlineEscape(string)
-
Default: "\n"

Changelog

Since 2.6.0 Introduced.

WP_Text_Diff_Renderer_inline::_splitOnWords() code WP 6.5.4

public function _splitOnWords( $string, $newlineEscape = "\n" ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.stringFound,WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase
	$string = str_replace( "\0", '', $string );
	$words  = preg_split( '/([^\w])/u', $string, -1, PREG_SPLIT_DELIM_CAPTURE );
	$words  = str_replace( "\n", $newlineEscape, $words ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase
	return $words;
}