Str.Trim

OpenTuring

Str.TrimPart of Str module

Syntax   Str.Trim (str : string) : string

Description   The Str.Trim function takes the string str and returns a string in all the leading and trailing spaces (the spaces at the beginning and the end) are deleted. For example, Str.Trim (" This is a test ") returns "This is a test". If str only has spaces in it, then Str.Trim will return an empty string.

Example   This program obtains input from the user until the user enters a line with non-whitespace characters in it.
        var line : string
        loop
            put "Enter a non-empty line of text: " ..
            get line : *
            exit when Str.Trim (line) not= ""
        end loop
        put "You entered ", line

Execute  

Status   Exported qualified.

This means that you can only call the function by calling Str.Trim, not by calling Trim.

See also   Str.Lower and Str.Upper.