1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Merge pull request #72288 from MewPurPur/use-string-repeat

Use `String.repeat()` to optimize several String methods
This commit is contained in:
Clay John
2023-05-05 09:56:48 -07:00
committed by GitHub
12 changed files with 37 additions and 94 deletions

View File

@@ -894,9 +894,9 @@ ScriptLanguage::ScriptTemplate ScriptCreateDialog::_parse_template(const ScriptL
if (line.begins_with("space-indent")) {
String indent_value = line.substr(17, -1).strip_edges();
if (indent_value.is_valid_int()) {
space_indent = "";
for (int i = 0; i < indent_value.to_int(); i++) {
space_indent += " ";
int indent_size = indent_value.to_int();
if (indent_size >= 0) {
space_indent = String(" ").repeat(indent_size);
}
} else {
WARN_PRINT(vformat("Template meta-use_space_indent need to be a valid integer value. Found %s.", indent_value));