42
CipherLab BASIC Programming Part I
RIGHT$
Purpose
To retrieve a given number of characters from the right side of the target
string.
Syntax A$ = RIGHT$(X$, N%)
Remarks “A$” is a string variable to be assigned to the result.
“X$” may be a string variable, string expression, or string constant.
“N%” is a numeric expression in the range of 0 to 255.
If N is larger than the length of X$, the entire string is returned.
If N is zero, the null string (with length 0) is returned.
Example
String1$ = “11025John Thomas, Accounting Manager”
String2$ = “,”
Title$ = RIGHT$(String1$, LEN(String1$) – INSTR(String1$, String2$))
TRIM_LEFT$
Purpose To return a copy of a string with leading blank spaces stripped away.
Syntax A$ = TRIM_LEFT$(X$)
Remarks “A$” is a string variable to be assigned to the result.
“X$”
is a string variable that may contain some space characters at the
beginning.
Example
S1$ = TRIM_LEFT$(“ Hello World!”) ‘ S1$ = “Hello World!”
TRIM_RIGHT$
Purpose To return a copy of a string with trailing blank spaces stripped away.
Syntax A$ = TRIM_RIGHT$(X$)
Remarks “A$” is a string variable to be assigned to the result.
“X$” is a string variable that may contain some space characters at the end.
Example
S2$ = TRIM_RIGHT$(“Hello World! ”) ‘ S2$ = “Hello World!”