public function StringTransformTrait::unSuffix in Drupal 7 to 8/9 Module Upgrader 8
Trims a suffix (as well as leading underscore, if any) from a string.
Parameters
string $string: The string to process.
string $suffix: The suffix to trim off, without leading underscore.
Return value
string
File
- src/
Utility/ StringTransformTrait.php, line 64
Class
- StringTransformTrait
- Contains methods for transforming strings in various helpful ways.
Namespace
Drupal\drupalmoduleupgrader\UtilityCode
public function unSuffix($string, $suffix) {
return preg_replace('/^_?' . $suffix . '$/', NULL, $string);
}