/** * Removes the given prefix from the string. * * This method has no effect if the string does not start with $prefix. * * @param string|Mol_DataType_String $prefix * @return Mol_DataType_String String without prefix. */ public function removePrefix($prefix) { $prefix = $this->toValue($prefix); return $this->createString(Mol_Util_String::removePrefix($this->value, $prefix)); }
/** * Ensures that removePrefix() does not modify the string if it does not * start with the prefix but contains it. */ public function testRemovePrefixDoesNotModifyStringIfItOnlyContainsPrefix() { $result = Mol_Util_String::removePrefix('this is a test string', 'test '); $this->assertEquals('this is a test string', $result); }