mirror of
https://github.com/godotengine/godot.git
synced 2025-10-31 21:51:22 +00:00
Add String::remove_char(s) methods for performance and convenience
This commit is contained in:
parent
cae3d722a3
commit
331a43a9d8
35 changed files with 221 additions and 54 deletions
|
|
@ -2249,7 +2249,7 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
|
|||
switch (expression_pattern) {
|
||||
case RGBA_PARAMETER: {
|
||||
color_args = line.substr(begin, end - begin);
|
||||
String stripped = color_args.replace(" ", "").replace("\t", "").replace("(", "").replace(")", "");
|
||||
String stripped = color_args.remove_chars(" \t()");
|
||||
PackedFloat64Array color = stripped.split_floats(",");
|
||||
if (color.size() > 2) {
|
||||
float alpha = color.size() > 3 ? color[3] : 1.0f;
|
||||
|
|
@ -2261,7 +2261,7 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
|
|||
end = line.length();
|
||||
}
|
||||
color_args = line.substr(begin, end - begin);
|
||||
const String color_name = color_args.replace(" ", "").replace("\t", "").replace(".", "");
|
||||
const String color_name = color_args.remove_chars(" \t.");
|
||||
const int color_index = Color::find_named_color(color_name);
|
||||
if (0 <= color_index) {
|
||||
const Color color_constant = Color::get_named_color(color_index);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue