public deletePrefix ( string $prefix ) : string | ||
$prefix | string | The prefix |
return | string | The string without prefix |
public function deletePrefix($prefix)
{
if ($this->startWith($prefix) === true) {
return substr($this->str, strlen($prefix));
}
return $this->str;
}
public function testDeletePrefix() { $str = new StringWrapper('Welcome to Spress'); $this->assertEquals('to Spress', $str->deletePrefix('Welcome ')); $this->assertEquals('Welcome to Spress', $str->deletePrefix('Hi')); $this->assertEquals('Welcome to Spress', $str->deletePrefix('')); }