Documentation Language: Swift

Function

split(_:_:)

Splits a string into an array of substrings using a delimiter.

func split(_ string: any EcoreValue, _ delimiter: any EcoreValue) throws -> [any EcoreValue]

Parameters

string

The string to split

delimiter

The delimiter to split on

Return Value

An array of substring parts

Discussion

The split operation divides the string into parts based on the specified delimiter string, returning an array of the resulting substrings.

Examples

let text = "apple,banana,cherry" as EString
let parts = try split(text, ",")  // Result: ["apple", "banana", "cherry"]