How to find and replace in GD Script

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

How do you find and replace in GD Script?

:bust_in_silhouette: Reply From: Calinou

Use the String.find() and String.replace() methods for this purpose. To only check whether a substring is present in a string, use the in operator (e.g. if "hello" in "hello world" will evaluate to true).

:bust_in_silhouette: Reply From: Ninfur

Just in-case you mean how to find and replace text in in Godot’s built in text editor:
Ctrl-R - Replace in current file
Ctrl-Shift-FReplace… - Replace in multiple files

1 Like