Example #1
0
 public function removePrefix($prefix)
 {
     return self::_wrap(s::removePrefix($this->value, self::unwrap($prefix)));
 }
Example #2
0
 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('', ''), '');
 }
Example #3
0
 /**
  * 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);
 }