mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
lib: Introduce function `String::cname()'
This commit is contained in:
parent
8008387559
commit
1c7eb0d59a
@ -21,4 +21,18 @@ class String
|
|||||||
{
|
{
|
||||||
return array_map('trim', explode($delimiter, $value));
|
return array_map('trim', explode($delimiter, $value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uppercase the first character of each word in a string assuming and removing the underscore as word separator
|
||||||
|
*
|
||||||
|
* Converts 'first_name' to 'firstName' for example.
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function cname($name)
|
||||||
|
{
|
||||||
|
return str_replace(' ', '', ucwords(str_replace('_', ' ', strtolower($name))));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user