Skip to content

Commit

Permalink
Merge pull request godotengine#20441 from AlexHolly/fix-string-format…
Browse files Browse the repository at this point in the history
…-case-placeholder

Fix format ignores case in placeholder
  • Loading branch information
akien-mga authored Jul 25, 2018
2 parents 46985ae + 84db705 commit 9e16f4a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/ustring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2768,7 +2768,7 @@ String String::format(const Variant &values, String placeholder) const {
val = val.substr(1, val.length() - 2);
}

new_string = new_string.replacen(placeholder.replace("_", key), val);
new_string = new_string.replace(placeholder.replace("_", key), val);
} else {
ERR_PRINT(String("STRING.format Inner Array size != 2 ").ascii().get_data());
}
Expand All @@ -2781,7 +2781,7 @@ String String::format(const Variant &values, String placeholder) const {
val = val.substr(1, val.length() - 2);
}

new_string = new_string.replacen(placeholder.replace("_", i_as_str), val);
new_string = new_string.replace(placeholder.replace("_", i_as_str), val);
}
}
} else if (values.get_type() == Variant::DICTIONARY) {
Expand All @@ -2801,7 +2801,7 @@ String String::format(const Variant &values, String placeholder) const {
val = val.substr(1, val.length() - 2);
}

new_string = new_string.replacen(placeholder.replace("_", key), val);
new_string = new_string.replace(placeholder.replace("_", key), val);
}
} else {
ERR_PRINT(String("Invalid type: use Array or Dictionary.").ascii().get_data());
Expand Down

0 comments on commit 9e16f4a

Please sign in to comment.