How to delete words from RichTextLabel

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Cobaltiz

I want to delete something from a RichTextLabel with code.
I tried:

var read_email="You have a new email!"
$Screen/TextArea.bbcode_text+=read_email+"\n"
$Screen/TextArea.bbcode_text.erase(read_email)

Doesn’t work. It gaves me an error. I tried with .remove , still doesn’t work.

:bust_in_silhouette: Reply From: jgodfrey

The RichTextLabel doesn’t seem to offer much in the way of methods for editing content. You can replace the content with new content (text or bbcode_text property), insert additional text (add_text()), or remove a specific line of content (remove_line()).

Depending on your needs, remove_line() might work for you. Otherwise, you might be better off to simply rebuild your text string as needed outside of the control and insert the new content via the text or bbcode_text property.

Alternatively, you might also look at the TextEdit control which provides a much richer editing API…