Documentation Language: Swift

Function

contains(_:_:)

Checks if a string contains a specified substring.

func contains(_ string: any EcoreValue, _ substring: any EcoreValue) throws -> EBoolean

Parameters

string

The string to search in

substring

The substring to search for

Return Value

true if the substring is found, false otherwise

Discussion

The contains operation tests whether the string contains the specified substring anywhere within it.

Examples

let text = "Hello World" as EString
let containsWorld = try contains(text, "World")  // Result: true
let containsXyz = try contains(text, "xyz")  // Result: false