12.6.8 EDIT$ Function
The EDIT$ function performs one or more string editing
functions, depending on the value of an argument you sup-
ply. The input string remains unchanged. In the following
example, stu_rec is a string expression and 32 determines the
editing function performed:
EDIT$(stu_rec,32)
Table 12-2 shows the action BASIC takes for a given value of
the integer expression.
All values are additive; for example, by specifying 168, you
can perform the following:
.
Discard leading spaces and tabs (value 8)
.
Convert lowercase letters to uppercase (value 32)
.
Discard trailing spaces and tabs (value 128)
The following example requests an input string, discards all
spaces and tabs, converts lowercase letters to uppercase, and
converts brackets to parentheses:
LINPUT "PLEASE TYPE A STRING";input_string$
new_string$ = EDIT$(input_string$, 2% + 32% + 64%)
PRINT new_string$
END
Output
PLEASE TYPE A STRING? 88 abc
TAB
[5,5]
88ABC(5,5)