class StringHelper in RESTful 7.2
Class StringHelper.
@package Drupal\restful\Util
Hierarchy
- class \Drupal\restful\Util\StringHelper
Expanded class hierarchy of StringHelper
1 file declares its use of StringHelper
- Request.php in src/
Http/ Request.php - Contains \Drupal\restful\Http\Request
File
- src/
Util/ StringHelper.php, line 15 - Contains \Drupal\restful\Util\String.
Namespace
Drupal\restful\UtilView source
class StringHelper {
/**
* Turns a string into camel case.
*
* @param string $input
* The input string.
*
* @return string
* The camelized string.
*/
public static function camelize($input) {
$input = preg_replace('/[-_]/', ' ', $input);
$input = ucwords($input);
$parts = explode(' ', $input);
return implode('', $parts);
}
/**
* Remove the string prefix from the token value.
*
* @param string $prefix
* The prefix to remove.
* @param string $haystack
* The string to remove the prefix from.
*
* @return string
* The prefixless string. NULL if the prefix is not found.
*/
public static function removePrefix($prefix, $haystack) {
$position = strpos($haystack, $prefix);
if ($position === FALSE) {
return NULL;
}
return substr($haystack, $position + strlen($prefix));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
StringHelper:: |
public static | function | Turns a string into camel case. | |
StringHelper:: |
public static | function | Remove the string prefix from the token value. |