replaceAll()

Replace all occurrences of a String.

Signature

replaceAll(match: String, replace: String): String

Description

The replaceAll() method returns a string with all occurrences of match replaced by replacement.

Parameters

Parameter Type Required Description

match

String

Yes

String to match on in the input string.

replace

String

Yes

String to replace match with.

Return value

Type Description

String

String with all occurrences of match replaced by replace.

Examples

'foobar'.replaceAll('foo', 'bar')
"barbar"

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!