You are here

public static function StringHelper::removePrefix in RESTful 7.2

Remove the string prefix from the token value.

Parameters

string $prefix: The prefix to remove.

string $haystack: The string to remove the prefix from.

Return value

string The prefixless string. NULL if the prefix is not found.

1 call to StringHelper::removePrefix()
Request::getCredentials in src/Http/Request.php
Get the credentials based on the $_SERVER variables.

File

src/Util/StringHelper.php, line 44
Contains \Drupal\restful\Util\String.

Class

StringHelper
Class StringHelper.

Namespace

Drupal\restful\Util

Code

public static function removePrefix($prefix, $haystack) {
  $position = strpos($haystack, $prefix);
  if ($position === FALSE) {
    return NULL;
  }
  return substr($haystack, $position + strlen($prefix));
}