From ff884533f93ed8fc85511739c8bedf9377376ffd Mon Sep 17 00:00:00 2001 From: Molkobain Date: Wed, 20 Nov 2019 17:39:08 +0100 Subject: [PATCH] Internal: Add utils::ToCamelCase($sInput) function --- application/utils.inc.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/application/utils.inc.php b/application/utils.inc.php index 65e7cb467..83f1ae7e2 100644 --- a/application/utils.inc.php +++ b/application/utils.inc.php @@ -2192,4 +2192,17 @@ class utils return getenv('username'); } + + /** + * Transform a snake_case $sInput into a CamelCase string + * + * @since 2.7.0 + * @param string $sInput + * + * @return string + */ + public static function ToCamelCase($sInput) + { + return str_replace(' ', '', ucwords(strtr($sInput, '_-', ' '))); + } }