Merge pull request #62083 from KoBeWi/string_slice'n_dice

Improve usage of `String.split()` vs `get_slice()`
This commit is contained in:
Thaddeus Crews 2025-09-22 08:50:01 -05:00
commit 94dbc42a56
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC
17 changed files with 45 additions and 50 deletions

View file

@ -843,11 +843,10 @@ void EditorPropertyEnum::setup(const Vector<String> &p_options) {
HashMap<int64_t, Vector<String>> items;
int64_t current_val = 0;
for (const String &option : p_options) {
Vector<String> text_split = option.split(":");
if (text_split.size() != 1) {
current_val = text_split[1].to_int();
if (option.get_slice_count(":") != 1) {
current_val = option.get_slicec(':', 1).to_int();
}
items[current_val].push_back(text_split[0]);
items[current_val].push_back(option.get_slicec(':', 0));
current_val += 1;
}