Text_Diff_Renderer_inline::_splitOnWords()publicWP 1.0

Метод класса: Text_Diff_Renderer_inline{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$Text_Diff_Renderer_inline = new Text_Diff_Renderer_inline();
$Text_Diff_Renderer_inline->_splitOnWords( $string, $newlineEscape );
$string (обязательный)
-
$newlineEscape **
-
По умолчанию: "\n"

Код Text_Diff_Renderer_inline::_splitOnWords() WP 6.5.2

function _splitOnWords($string, $newlineEscape = "\n")
{
    // Ignore \0; otherwise the while loop will never finish.
    $string = str_replace("\0", '', $string);

    $words = array();
    $length = strlen($string);
    $pos = 0;

    while ($pos < $length) {
        // Eat a word with any preceding whitespace.
        $spaces = strspn(substr($string, $pos), " \n");
        $nextpos = strcspn(substr($string, $pos + $spaces), " \n");
        $words[] = str_replace("\n", $newlineEscape, substr($string, $pos, $spaces + $nextpos));
        $pos += $spaces + $nextpos;
    }

    return $words;
}