Documentation Language: Swift

Function

replaceAll(_:_:_:)

Replaces all occurrences of a substring with another string.

func replaceAll(_ string: any EcoreValue, _ search: any EcoreValue, _ replacement: any EcoreValue) throws -> EString

Parameters

string

The source string

search

The substring to search for

replacement

The string to replace with

Return Value

A new string with all occurrences replaced

Discussion

The replaceAll operation creates a new string where all occurrences of the search string are replaced with the replacement string.

Examples

let text = "Hello Hello World" as EString
let replaced = try replaceAll(text, "Hello", "Hi")  // Result: "Hi Hi World"