summaryrefslogtreecommitdiff
path: root/core/ustring.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/ustring.cpp')
-rw-r--r--core/ustring.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp
index d2d4b6507f..dcb6545bd1 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -30,14 +30,15 @@
#include "ustring.h"
#include "color.h"
-#include "io/md5.h"
-#include "io/sha256.h"
#include "math_funcs.h"
#include "os/memory.h"
#include "print_string.h"
#include "ucaps.h"
#include "variant.h"
+#include "thirdparty/misc/md5.h"
+#include "thirdparty/misc/sha256.h"
+
#include <wchar.h>
#ifndef NO_USE_STDLIB
@@ -513,14 +514,16 @@ String String::camelcase_to_underscore(bool lowercase) const {
for (size_t i = 1; i < this->size(); i++) {
bool is_upper = cstr[i] >= A && cstr[i] <= Z;
+ bool is_number = cstr[i] >= '0' && cstr[i] <= '9';
bool are_next_2_lower = false;
bool was_precedent_upper = cstr[i - 1] >= A && cstr[i - 1] <= Z;
+ bool was_precedent_number = cstr[i - 1] >= '0' && cstr[i - 1] <= '9';
if (i + 2 < this->size()) {
are_next_2_lower = cstr[i + 1] >= a && cstr[i + 1] <= z && cstr[i + 2] >= a && cstr[i + 2] <= z;
}
- bool should_split = ((is_upper && !was_precedent_upper) || (was_precedent_upper && is_upper && are_next_2_lower));
+ bool should_split = ((is_upper && !was_precedent_upper && !was_precedent_number) || (was_precedent_upper && is_upper && are_next_2_lower) || (is_number && !was_precedent_number));
if (should_split) {
new_string += this->substr(start_index, i - start_index) + "_";
start_index = i;