You are here: Function Reference > Alphabetical Listing > T > Trim

Trim

Use this function to remove leading and/or trailing spaces from a given string. The integer parameter determines whether spaces on the left, right, or both ends are to be removed. The resulting string is returned.

Syntax

Trim (String, Integer)

Parameter

Description

String

Enter a valid string. The default is the value of the current field.

Integer

Choose from these options:

0 - remove trailing spaces
1 - remove leading spaces
2 - remove leading and trailing spaces

The default is two (2).

The system removes leading and trailing spaces from the string specified in parameter one. The Integer parameter determines which spaces are removed.

Example

Here are some examples:

(Assume the current field contains the text " Your Name")

Function

Result

Explanation

Trim (" Value ")

"Value"

Defaults to trim leading and trailing spaces.

Trim (" Value ", 0)

" Value"

Removes trailing spaces.

Trim( )

"Your Name"

Use current field and remove leading and trailing spaces. See the note below.

Note During field entry, the system automatically removes trailing spaces from values entered by the user. Only variables assigned during DAL scripts are likely to have trailing spaces.

See also