TRIM Function

The TRIM function removes any extraneous space from the given string.

Format

TRIM(expr)

Parameter(s)

expr

An expression evaluating to the string to be trimmed.

Description

The TRIM function reduces multiple consecutive blank spaces and tabs in expr to one blank space or tab, and removes all leading and trailing spaces.

When creating a new file item, it is a good practice to TRIM the name of the new item, to provide consistency and avoid later confusion.

Example

In this example, the TRIM function is used as soon as the operator enters a last name which is used as an item-ID. Any extra spaces that the operator might have entered in the name are then stripped out, and the item-ID becomes more likely to be matched successfully.

PRINT "ENTER LAST NAME: " :   

INPUT NAME  

NAME = TRIM(NAME)   

READ RECORD FROM GUESTS,NAME ELSE

   FOUND = 0    

END

See Also

Statement and Function Reference