HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)

3- 27
The null string ("") is less than every string except itself, to which it
is equal. The following explanation does not apply to the null string.
HP Business BASIC/XL compares the strings S1$ and S2$ as follows
(S1$[
c
;1] and S2$[
c
;1] are corresponding characters).
1.
c
=1
2. If CHR$(S1$[
c
;1])<CHR$(S2$[
c
;1]), then S1$ is less than S2$.
Stop.
3. If CHR$(S1$[
c
;1])>CHR$(S2$[
c
;1]), then S1$ is greater than S2$.
Stop.
4. CHR$(S1$[
c
;1])=CHR$(S2$[
c
;1]). If
c
+1 is in the range [1, MIN(
LEN(S1$), LEN(S2$) )], then
c
=
c
+1 and return to step 2.
5. If LEN(S1$) = LEN(s2$) then S1$ is equal to S2$. Stop.
6. If LEN(S1$) > LEN(s2$) then S1$ is greater than S2$. Stop.
7. If LEN(S1$) < LEN(s2$) then S1$ is less than S2$. Stop.
(MIN and LEN are the predefined minimum and length functions.)
Examples
The following expressions are TRUE:
"Abc" = "Abc" "Cat" <> "Cats" "Bird" < "Cats"
"Abc" <= "Abc" "Cat" < "Cats" "Ears" > "Early"
"Abc" >= "Abc" "Cat" <= "Cats" "Bird " + "Dog" = "Bird Dog"
The following expressions are FALSE:
"Abc" # "Abc" "Cat" = "Cats" "Bird" >= "Cats"
"Abc" < "Abc" "Cat" < "Bats" "Ears" < "Early"
"Abc" > "Abc" "BAT" = "bat" "Bird" + "Dog" = "Bird Dog"
Boolean Operators
A Boolean operator has one or two operands and a Boolean result.
The Boolean values TRUE and FALSE are represented by the numeric values
one and zero. The operands of a Boolean expression can be Boolean or
numeric values. A numeric operand is considered TRUE if it is nonzero
and FALSE if it is zero.
HP Business BASIC/XL also provides the two keywords TRUE and FALSE. TRUE
is a numeric constant of short integer type equal to one. FALSE is a