diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-07-24 14:21:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-24 14:21:06 +0200 |
commit | 96d7bc62af25b85b8b9cc091eeea1e7a784ba624 (patch) | |
tree | 83d8a70c911fe7f8d20080a1395d195eb8370d05 /core/string/ustring.cpp | |
parent | 9ac27b58c53b50b5c7085a8fdee653e9eff159d1 (diff) | |
parent | 4e6efd1b07f1c6d53d226977ddc729333b74306a (diff) |
Merge pull request #50511 from aaronfranke/iterators
Use C++ range iterators for Lists in many situations
Diffstat (limited to 'core/string/ustring.cpp')
-rw-r--r-- | core/string/ustring.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp index 4cd2915ffa..dbb8dc8283 100644 --- a/core/string/ustring.cpp +++ b/core/string/ustring.cpp @@ -3421,11 +3421,8 @@ String String::format(const Variant &values, String placeholder) const { List<Variant> keys; d.get_key_list(&keys); - for (List<Variant>::Element *E = keys.front(); E; E = E->next()) { - String key = E->get(); - String val = d[E->get()]; - - new_string = new_string.replace(placeholder.replace("_", key), val); + for (Variant &key : keys) { + new_string = new_string.replace(placeholder.replace("_", key), d[key]); } } else { ERR_PRINT(String("Invalid type: use Array or Dictionary.").ascii().get_data()); |