public function testIReplace() { $this->eq(s::iReplace('abcXabc', 'x', 'y'), 'abcyabc'); $this->eq(s::iReplace('afoOBara', 'foobar', 'b'), 'aba'); $this->eq(s::iReplace('aaxYaaaXya', 'xy', 'b'), 'aabaaaba'); $this->eq(s::iReplace('', 'abc', ''), ''); $this->eq(s::iReplace('abc', '', 'x'), 'xaxbxcx'); $this->eq(s::iReplace('', '', 'x'), 'x'); }
public function iReplaceAndCount($old, $new) { $r = s::iReplace($this->value, self::unwrap($old), self::unwrap($new)); $r[0] = new self($r[0]); return $r; }