mirror of
https://github.com/godotengine/godot.git
synced 2024-11-13 23:52:41 +00:00
Merge pull request #20443 from AlexHolly/add-string-format-no-index
Added String.format "no index" support
This commit is contained in:
commit
7718b90d92
@ -2788,7 +2788,11 @@ String String::format(const Variant &values, String placeholder) const {
|
||||
val = val.substr(1, val.length() - 2);
|
||||
}
|
||||
|
||||
new_string = new_string.replace(placeholder.replace("_", i_as_str), val);
|
||||
if (placeholder.find("_") > -1) {
|
||||
new_string = new_string.replace(placeholder.replace("_", i_as_str), val);
|
||||
} else {
|
||||
new_string = new_string.replace_first(placeholder, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (values.get_type() == Variant::DICTIONARY) {
|
||||
|
Loading…
Reference in New Issue
Block a user