English
Language : 

NSB8 Datasheet, PDF (90/158 Pages) List of Unclassifed Manufacturers – BASIC interpreter for Z80 family
grifo®
ITALIAN TECHNOLOGY
USING STRINGS
A string is a sequence of letters and/or other characters. For example, the following are strings:
HELLO NG;34* ABC123
THE DATE IS 7/7/78
STRING CONSTANTS
Strings enclosed in quotation marks are called string constants. Note that the quotation marks
themselves are not part of the string, but serve only to mark its boundaries for convenient recognition
by both human beings and machines. The following are examples of BASIC string constants:
“HELLO” “NG;34*” “ABC123”
“THE DATE IS 7/7/78”
THE NULL STRING
The string represented by two consecutive quotes (“ “) contains no characters, and is called the null
string.
STRING VARIABLES
Just as numbers may be held in numeric variables, so can strings be held in string variables. String
variables are named similarly to numeric variables, and differ only in that a dollar sign ($) is added
to the name to denote the type of the variable as string. Thus, a legal string variable name consists
of a single capital letter (A-Z) followed by a dollar sign, or a capital letter and a single digit (0-9),
followed by a dollar sign.
Examples of legal string variable names:
A$
Q7$
Z3$
R$
DIMENSIONING STRING VARIABLES
Before they can be used to hold string values in a program, string variables must be
dimensioned. Dimensioning a string causes BASIC to reserve memory space to hold the value of a
string. To dimension a string, the string name must be included in a DIM statement, along with its
maximum length in characters, before it is used to store a string value in a program (for the proper
method of doing this, see statement DIM). If you use a string variable without having first declared
it in a DIM statement, BASIC will automatically dimension it to a maximum length of 10
characters. Once created, strings may not be redimensioned in a program.
A string variable may contain any string whose length is less than or equal to the dimension of the
string. The current length of the variable is the length, in characters, of the string value it
contains. Thus, if A$ is dimensioned to a maximum length of 26 characters, it may hold the entire
alphabet (current length = 26 characters), the string “CAT” (current length = 3), or even the null string
Page 78
NSB8
Rel. 5.10