public function testReplace() { $this->eq(s::replace('abcxabc', 'x', 'y'), 'abcyabc'); $this->eq(s::replace('afoobara', 'foobar', 'b'), 'aba'); $this->eq(s::replace('aaxyaaaxya', 'xy', 'b'), 'aabaaaba'); $this->eq(s::replace('', 'abc', ''), ''); $this->eq(s::replace('abc', '', 'x'), 'xaxbxcx'); $this->eq(s::replace('', '', 'x'), 'x'); }
public function iReplace($old, $new) { return new self(s::replace($this->value, self::unwrap($old), self::unwrap($new))); }