Documentation Language: Swift

Function

endsWith(_:_:)

Checks if a string ends with a specified suffix.

func endsWith(_ string: any EcoreValue, _ suffix: any EcoreValue) throws -> EBoolean

Parameters

string

The string to test

suffix

The suffix to check for

Return Value

true if the string ends with the suffix, false otherwise

Discussion

The endsWith operation tests whether the string ends with the specified suffix string.

Examples

let text = "Hello World" as EString
let endsWithWorld = try endsWith(text, "World")  // Result: true
let endsWithHello = try endsWith(text, "Hello")  // Result: false