diff --git a/library/Icinga/Util/String.php b/library/Icinga/Util/String.php index 0bebb06e7..248ab0d34 100644 --- a/library/Icinga/Util/String.php +++ b/library/Icinga/Util/String.php @@ -23,16 +23,17 @@ class String } /** - * Uppercase the first character of each word in a string assuming and removing the underscore as word separator + * Uppercase the first character of each word in a string * * Converts 'first_name' to 'firstName' for example. * * @param string $name + * @param string $separator Word separator * * @return string */ - public static function cname($name) + public static function cname($name, $separator = '_') { - return str_replace(' ', '', ucwords(str_replace('_', ' ', strtolower($name)))); + return str_replace(' ', '', ucwords(str_replace($separator, ' ', strtolower($name)))); } }