Purpose

TRIM removes specified characters from a string.
 

Syntax

variable = TRIM (operand1,{operand2,operand3})
 

Operation

operand1 is any valid alphanumeric string
operand2
 is any valid alphanumeric or wide character constant or variable specifying the characters to be removed from the string
operand3
 is any alphanumeric variable with the value of A, B, D, L, R or X

variable
is the resulting alphanumeric string
 

Remarks

If operand 2 and 3 are not present TRIM will remove all leading and trailing spaces from operand 1.

If operands 2 and 3 are present the TRIM process will be applied to each character specified in operand 2 independently.

The value of operand 3 will cause the following process to be applied to operand 1:

if A will remove all the characters specified in operand 2
if B will remove the leading and trailing occurrences of the characters in operand 2
if D will remove duplicated (i.e. adjacent) occurrences of characters in operand 2
if L will remove the leading occurrences of the characters in operand 2
if R will remove the trailing occurrences of the characters in operand 2
if X will remove the leading, trailing and duplicated occurrences of the characters in operand 2.
 

Example
 

 TRIM ("   ,,, Hello ,,,   "," ,",2D" ...will return... " , Hello , "

 

Comment on this topic

Topic ID: 520130

 
 
 

Table of Contents

Index

Glossary

-Search-

Back