Skip to main content

STRCOMP

Syntax

STRCOMP( string1, string2 )

Description

This compares the two strings returning -1 if string1 would sort before string2.  Returning 0 if the two strings are equal, and 1 if string1 would sort after string2. String1 and String2 may be constant or variable strings.

String functions may not be nested. 

Example

DIM text$(10)

text$ =
"BAT"
PRINT STRCOMP(text$,
text$) ' will display
0
PRINT STRCOMP(text$,
"BAT") ' will display
0 )
PRINT STRCOMP(text$,
"BOOT") ' will display -1 )

PRINT STRCOMP(text$,
"BAA") ' will
display 1

Differences from other BASICs

  • same function as Visual BASIC
  • no equivalent in PBASIC

See also