public function StringTransformTrait::unPrefix in Drupal 7 to 8/9 Module Upgrader 8
Trims a prefix (as well as leading or trailing underscore, if any) from a string.
Parameters
string $string: The string to process.
string $prefix: The prefix to trim off, without leading or trailing underscores.
Return value
string
2 calls to StringTransformTrait::unPrefix()
- ContentRoute::getName in src/
Plugin/ DMU/ Routing/ ContentRoute.php - Generates the route's machine-readable name.
- FormRoute::getName in src/
Plugin/ DMU/ Routing/ FormRoute.php - Generates the route's machine-readable name.
File
- src/
Utility/ StringTransformTrait.php, line 50
Class
- StringTransformTrait
- Contains methods for transforming strings in various helpful ways.
Namespace
Drupal\drupalmoduleupgrader\UtilityCode
public function unPrefix($string, $prefix) {
return preg_replace('/^_?' . $prefix . '_/', NULL, $string);
}