Ouzo\Utilities\Strings::removePrefixes PHP 메소드

removePrefixes() 공개 정적인 메소드

Example: $string = 'prefixRest'; $withoutPrefix = Strings::removePrefixes($string, array('pre', 'fix')); Result: Rest
public static removePrefixes ( string $string, array $prefixes ) : mixed
$string string
$prefixes array
리턴 mixed
    public static function removePrefixes($string, array $prefixes)
    {
        return array_reduce($prefixes, function ($string, $prefix) {
            return Strings::removePrefix($string, $prefix);
        }, $string);
    }

Usage Example

예제 #1
0
 /**
  * @test
  */
 public function shouldRemovePrefixes()
 {
     //given
     $string = 'prefixRest';
     //when
     $withoutPrefix = Strings::removePrefixes($string, array('pre', 'fix'));
     //then
     $this->assertEquals('Rest', $withoutPrefix);
 }