Documentation Language: Swift

Function

trim(_:)

Trims whitespace from both ends of a string.

func trim(_ string: any EcoreValue) throws -> EString

Parameters

string

The string to trim

Return Value

A new string with leading and trailing whitespace removed

Discussion

The trim operation removes leading and trailing whitespace characters (spaces, tabs, newlines) from the string.

Examples

let text = "  Hello World  " as EString
let trimmed = try trim(text)  // Result: "Hello World"