Skip to main content

String Comparisons

Syntax


string1 compare_op string2 string1    =   string-variable | byref_string_pointer | string_constant 
compare_op   =     >  |  >=  |  =  |  <>  |   =<  |   <
string2    =   string1_types | string_functions\

Description


This compares the two strings returning -1 if string1 satisfies the  comparison_op with string2.  Returning 0 if the comparison_op is not true.

String1 and String2 may be constant or variable strings.   String2 may also be a FUNCTION of type STRING.

Example

\

DIM text(10) as STRING

text =
"BAT"
PRINT text
> "BBB" ' will display
0
PRINT "BBB" <=
text ' will display
0
PRINT text <
"BOOT"
' will display 1

PRINT text
> "BAA" ' will
display 1

\

Differences from other BASICs

\

  • similar to Visual BASIC
  • no equivalent in PBASIC\

See also

\