aboutsummaryrefslogtreecommitdiff
path: root/src/common/string_utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/string_utils.cpp')
-rw-r--r--src/common/string_utils.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/common/string_utils.cpp b/src/common/string_utils.cpp
index 6956c230cd..a208555831 100644
--- a/src/common/string_utils.cpp
+++ b/src/common/string_utils.cpp
@@ -272,6 +272,30 @@ int ReplaceAllSubstrings(std::string *str,
return count;
}
+std::string ToCamelCase(const std::string &str)
+{
+ std::string result;
+
+ bool lastWasUnderscore = false;
+ for (char c : str)
+ {
+ if (c == '_')
+ {
+ lastWasUnderscore = true;
+ continue;
+ }
+
+ if (lastWasUnderscore)
+ {
+ c = static_cast<char>(std::toupper(c));
+ lastWasUnderscore = false;
+ }
+ result += c;
+ }
+
+ return result;
+}
+
std::vector<std::string> GetStringsFromEnvironmentVarOrAndroidProperty(const char *varName,
const char *propertyName,
const char *separator)