_splitOnWords example

$nl = "\0";

        if ($this->_split_characters) {
            $diff = new Text_Diff('native',
                                  array(preg_split('//', $text1),
                                        preg_split('//', $text2)));
        } else {
            /* We want to split on word boundaries, but we need to preserve * whitespace as well. Therefore we split on words, but include * all blocks of whitespace in the wordlist. */
            $diff = new Text_Diff('native',
                                  array($this->_splitOnWords($text1$nl),
                                        $this->_splitOnWords($text2$nl)));
        }

        /* Get the diff in inline format. */
        $renderer = new Text_Diff_Renderer_inline
            (array_merge($this->getParams(),
                         array('split_level' => $this->_split_characters ? 'characters' : 'words')));

        /* Run the diff and get the output. */
        return str_replace($nl, "\n", $renderer->render($diff)) . "\n";
    }

    
Home | Imprint | This part of the site doesn't use cookies.