StringUtils
final class StringUtils (View source)
Methods
static array
csvToArray($args)
Convert a csv string, or an array of items which may contain csv strings, into an array of items.
static string
interpolate(string $message, array $context = [])
Replace placeholders in a string.
static string
replaceTilde($path, $home)
Replace tilde in a path with the HOME directory.
static string
generatePassword(int $length = 10)
Generate a random alphanumeric password. Copied from user.module.
Details
static array
csvToArray($args)
Convert a csv string, or an array of items which may contain csv strings, into an array of items.
static string
interpolate(string $message, array $context = [])
Replace placeholders in a string.
Examples: interpolate('Hello, {var}', ['var' => 'world']) ==> 'Hello, world' interpolate('Do !what', ['!what' => 'work']) ==> 'Do work'
static string
replaceTilde($path, $home)
Replace tilde in a path with the HOME directory.
static string
generatePassword(int $length = 10)
Generate a random alphanumeric password. Copied from user.module.