1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

Add String::remove_char(s) methods for performance and convenience

This commit is contained in:
A Thousand Ships
2024-05-28 12:55:07 +02:00
parent cae3d722a3
commit 331a43a9d8
35 changed files with 221 additions and 54 deletions

View File

@@ -1906,7 +1906,7 @@ void EditorHelp::_update_doc() {
_push_code_font();
if (constant.value.begins_with("Color(") && constant.value.ends_with(")")) {
String stripped = constant.value.replace(" ", "").replace("Color(", "").replace(")", "");
String stripped = constant.value.remove_char(' ').replace("Color(", "").remove_char(')');
PackedFloat64Array color = stripped.split_floats(",");
if (color.size() >= 3) {
class_desc->push_color(Color(color[0], color[1], color[2]));
@@ -2439,7 +2439,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt, const C
const Color kbd_bg_color = p_owner_node->get_theme_color(SNAME("kbd_bg_color"), SNAME("EditorHelp"));
const Color param_bg_color = p_owner_node->get_theme_color(SNAME("param_bg_color"), SNAME("EditorHelp"));
String bbcode = p_bbcode.dedent().replace("\t", "").replace("\r", "").strip_edges();
String bbcode = p_bbcode.dedent().remove_chars("\t\r").strip_edges();
// Select the correct code examples.
switch ((int)EDITOR_GET("text_editor/help/class_reference_examples")) {