Documentation Language: Swift

Function

at(_:_:)

Returns the character at a specific position in a string.

func at(_ string: any EcoreValue, _ index: any EcoreValue) throws -> EString

Parameters

string

The source string

index

The position of the character (1-based)

Return Value

A single-character string

Discussion

The at operation returns the character at the specified 1-based index in the string. This is useful for character-level string manipulation.

Examples

let text = "Hello" as EString
let char = try at(text, 2)  // Result: "e"
let firstChar = try at(text, 1)  // Result: "H"