Skip to reading
GDScript Programming & Godot

Math, randomness and data conversion

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page
On this page

Replace()#

Code example
Replace(value: Variant, search: Variant, replacement: Variant) -> String

Replace case-sensitive occurrences of text.

Returns: String.

Code example
Replace("red door", "red", "blue")

Split()#

Code example
Split(value: Variant, delimiter: String = " ", allow_empty: bool = true) -> Array[String]

Split text into ordinary typed String entries.

Returns: Array[String].

Code example
Split("key,note", ",", false)

Join()#

Code example
Join(values: Array, delimiter: String = "") -> String

Convert array entries to text and join them.

Returns: String.

Code example
Join(["key", "note"], ", ")

Clamp()#

Code example
Clamp(value: float, minimum: float, maximum: float) -> float

Limit a float to a minimum/maximum.

Returns: Float.

Code example
Clamp(120.0, 0.0, 100.0)
Page 83 of 378Permalink
Go to page