summaryrefslogtreecommitdiff
path: root/core/string
diff options
context:
space:
mode:
authorJonas Bernemann <jbernemann@gmx.de>2021-06-03 23:07:38 +0200
committerJonas Bernemann <jbernemann@gmx.de>2021-06-03 23:07:38 +0200
commita403efb67c5a0e39911b9bdb3669d5d45b049c7e (patch)
treed69ae9f684b723b7ecdcf6b917e312e86bd16630 /core/string
parentea2a0b54554c09999d74212925322e8c7b2437e0 (diff)
String::format leave passed values untouched
If the passed value or key contains double quotation marks it will no longer get removed.
Diffstat (limited to 'core/string')
-rw-r--r--core/string/ustring.cpp19
1 files changed, 0 insertions, 19 deletions
diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp
index 49cf171f2b..7fec96944a 100644
--- a/core/string/ustring.cpp
+++ b/core/string/ustring.cpp
@@ -3382,17 +3382,10 @@ String String::format(const Variant &values, String placeholder) const {
if (value_arr.size() == 2) {
Variant v_key = value_arr[0];
String key = v_key;
- if (key.left(1) == "\"" && key.right(1) == "\"") {
- key = key.substr(1, key.length() - 2);
- }
Variant v_val = value_arr[1];
String val = v_val;
- if (val.left(1) == "\"" && val.right(1) == "\"") {
- val = val.substr(1, val.length() - 2);
- }
-
new_string = new_string.replace(placeholder.replace("_", key), val);
} else {
ERR_PRINT(String("STRING.format Inner Array size != 2 ").ascii().get_data());
@@ -3401,10 +3394,6 @@ String String::format(const Variant &values, String placeholder) const {
Variant v_val = values_arr[i];
String val = v_val;
- if (val.left(1) == "\"" && val.right(1) == "\"") {
- val = val.substr(1, val.length() - 2);
- }
-
if (placeholder.find("_") > -1) {
new_string = new_string.replace(placeholder.replace("_", i_as_str), val);
} else {
@@ -3421,14 +3410,6 @@ String String::format(const Variant &values, String placeholder) const {
String key = E->get();
String val = d[E->get()];
- if (key.left(1) == "\"" && key.right(1) == "\"") {
- key = key.substr(1, key.length() - 2);
- }
-
- if (val.left(1) == "\"" && val.right(1) == "\"") {
- val = val.substr(1, val.length() - 2);
- }
-
new_string = new_string.replace(placeholder.replace("_", key), val);
}
} else {