Trim

Contents

Description

This function removes spaces from string. It has a parameter n which allows you either choose to remove spaces from leading and trailing spaces from the string or remove all spaces, including those inside the string.

Syntax

string Trim(string str$[, int n = 0])$

Parameters

str

is the string from which you want to remove spaces.

n

specifies which kinds of spaces you want to remove, options including
0 (default) Trim leading and trailing spaces
1 Trim all spaces, including those inside the string

Return

returns the string which spaces have been removed.

Example

string str1$ = " abc ABC "; 
string newStr1$ =Trim(str1$,0)$ ;
newStr1$ = ; //should be "abc ABC"
string str2$ = " abc abc ";
string newStr2$ = Trim(str2$,1)$;
newStr2$ = ; //should be "abcabc"

See Also

Search