Welcome to jBASE's new documentation site! Many answers to your questions can be found by searching the Knowledgebase or viewing the jBASE Documentation. We also have a Google Group for peer discussion about jBASE. If you are unable to find the information you are looking for, jBASE Support will be glad to assist in resolving your technical problems. Enjoy and please provide comments and feedback .

How can we help you?

TRIM

Description

The TRIM statement allows characters to be removed from a string in a number of ways. It takes the general form:

TRIM(expression1 {, expression2{, type}})

Where:

expression1 specifies the string from which to trim characters.

expression2 may optionally specify the character to remove from the string. If not specified then the space character is assumed.

The trim types available are:

Type
Operation
L
removes leading characters only
T
removes trailing characters only
B
removes leading and trailing characters
A
removes all occurrences of the character
R
removes leading, trailing and redundant characters
F
removes leading spaces and tabs
E
removes trailing spaces and tabs
D
removes leading, trailing and redundant spaces and tabs.


An example of use is as: 

INPUT ANS
ANS = TRIM (ANS," ","D")

or: 

INPUT ANS
ANS = TRIM(ANS)

to remove spaces and tabs. Note the second parameter has been ignored in the first code sample.


Go back to jBASE BASIC.

Was this article helpful?