CitectVBA Programming Reference > CitectVBA Function Reference > String Functions > Trim

Trim

Strips any leading and trailing spaces from Str variable.

Syntax

Trim(Str)

Str:

A string or expression that can represent a valid text value.

Return Value

Returns a String.

Related Functions

LTrim | RTrim

Example

Dim strTest as String
Dim strResult as String
Dim lngStartLength as Long
Dim lngFinishLength as Long
strTest = " CitectVBA "
lngStartLength = Len(strTest)
' returns 19
strResult = Trim(strTest)
' returns "CitectVBA"
lngStringLength = Len(strResult)
' returns 9