Exemplo n.º 1
0
 /**
  * Removes prefixes defined in array from string.
  *
  * Example:
  * <code>
  * $string = 'prefixRest';
  * $withoutPrefix = Strings::removePrefixes($string, array('pre', 'fix'));
  * </code>
  * Result:
  * <code>
  * Rest
  * </code>
  *
  * @param string $string
  * @param array $prefixes
  * @return mixed
  */
 public static function removePrefixes($string, array $prefixes)
 {
     return array_reduce($prefixes, function ($string, $prefix) {
         return Strings::removePrefix($string, $prefix);
     }, $string);
 }
Exemplo n.º 2
0
 public static function removePrefix($prefix)
 {
     return function ($string) use($prefix) {
         return Strings::removePrefix($string, $prefix);
     };
 }