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


Why they didn’t follow the convention?

CTRL+F and CTRL+H for replace

Is that configurable?

While editing a project, in the top left corner of the Godot Editor, go to:
Editor → Editor Settings → Shortcuts

You can click on “Listening for input…” and do ctrl+R to show the binding.