public function removePrefix($prefix) { return self::_wrap(s::removePrefix($this->value, self::unwrap($prefix))); }
public function testRemovePrefix() { $this->eq(s::removePrefix('abcdef', 'abc'), 'def'); $this->eq(s::removePrefix('abcdef', 'xyz'), null); $this->eq(s::removePrefix('abcdef', 'cde'), null); $this->eq(s::removePrefix('abcdef', ''), 'abcdef'); $this->eq(s::removePrefix('abcdef', 'abcdef'), ''); $this->eq(s::removePrefix('abc', 'xyzijk'), null); $this->eq(s::removePrefix('abc', 'abcdef'), null); $this->eq(s::removePrefix('', 'abc'), null); $this->eq(s::removePrefix('', ''), ''); }
/** * Strip off the `path` from an absolute path, or return `null` if the * path does not match. * * @param string $abs_path * @return string|null */ public function removePath($abs_path) { return \Jitsu\StringUtil::removePrefix($abs_path, $this->base_path); }