Contents

Roo

Text.replace_all!()

Returns a new Text object who’s value is created by replacing all instances of the passed what text with the passed replacement text. If this Text object does not contain the what text then it returns a new Text object who’s value is the same as the original’s. The original text is changed to the new value.

text.replace_all!(what as Text, replacement as Text) as Text

Parameters

  • what. Text object. The text you are searching for
  • replacement. Text object. The replacement text to use for each found occurrence of what

Returns

  • A new Text object. The original text is changed to the same value as the return value

Example

var a = "Go Go Gadget!"
var b = a.replace_all!("Go", "Yo")
print(a) # => "Yo Yo Gadget!"
print(b) # => "Yo Yo Gadget!"