Trim

From Xojo Documentation

fa-info-circle-32.png
Trim (the global function) is here for compatibility with Visual Basic. You should instead use String.Trim.
Method

Returns the string passed with leading and trailing whitespaces removed.

Syntax

result=Trim(sourceString)
OR'
result=stringVariable.Trim

Part Type Description
result String SourceString with leading and trailing whitespaces removed.
sourceString String The source, a copy of which, to be returned with leading and trailing whitespaces removed.
stringVariable String Any variable of type String.

Notes

Trim uses the list of unicode "whitespace" characters at http://www.unicode.org/Public/UNIDATA/PropList.txt.

Examples

This example removes the whitespaces from either side of the string passed:

Var s As String
s = Trim(" Hello World ") // Returns "Hello World"
s = " Hello World "
s = s.Trim // Returns "Hello World"

See Also

Asc, Chr, InStr, Left, Len, LTrim, Mid, Right, RTrim functions.