Commands For String Processing; Combining Strings; Comparing Strings - CipherLab 8 Series User Manual

Hide thumbs Also See for 8 Series:
Table of Contents

Advertisement

4.4 COMMANDS FOR STRING PROCESSING

This section describes BASIC commands used to manipulate sequences of ASCII
characters known as strings. In CipherLab BASIC, strings are always variable length,
from null to a maximum of 250.

4.4.1 COMBINING STRINGS

Two strings can be combined with the plus operator "+". The string following the plus
operator is appended to the string preceding the plus operator. For example,
...
Data$ = DATE$ + TIME$ + EmployeeID$
SAVE_TRANSACTION(Data$)
...

4.4.2 COMPARING STRINGS

Two strings can be compared with the relational operators, see section 3.3.3.
A single character is greater than another character if its ASCII value is greater. For
example, the ASCII value of the letter "B" is greater than the ASCII value of the letter
"A", so the expression "B" > "A" is true.
When comparing two strings, BASIC looks at the ASCII values of corresponding
characters. The first character where the two strings differ determines the alphabetical
order of the strings. For example, the strings "aaabaa" and "aaaaaaaa" are the same up
to the fourth character in each, "b" and "a". Since the ASCII value of "b" is larger than
that of "a", the expression "aaabaa" > "aaaaaaaa" is true.
If there is no difference between the corresponding characters of two strings and they
are the same length, then the two strings are equal. If there is no difference between the
corresponding characters of two strings, but one of the strings is longer, the longer string
is greater than the shorter string. For example, "abc" = "abc" and "aaaaaaaa" > "aaaaa"
are both true expressions.
Leading and trailing blank spaces are significant in comparing strings. For example, the
string " abc" is less than the string "abc" since a blank space is less than an "a"; on the
other hand, the string "abc " is greater than the string "abc".
Chapter 4
BASIC Commands
39

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the 8 Series and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

83008000840087008200

Table of Contents