REM >strcomp shav$ = "Shaw, George Bernard" shakes$ = "Shakespeare, William" : REM test equality IF shav$ = shakes$ THEN PRINT "The two strings are equal" ELSE PRINT "The two strings are not equal" : REM test inequality IF shav$ <> shakes$ THEN PRINT "The two strings are unequal" ELSE PRINT "The two strings are not unequal" : REM test lexical ordering IF shav$ > shakes$ THEN PRINT shav$; " is lexically higher than "; shakes$ ELSE PRINT shav$; " is not lexically higher than "; shakes$ IF shav$ < shakes$ THEN PRINT shav$; " is lexically lower than "; shakes$ ELSE PRINT shav$; " is not lexically lower than "; shakes$ REM the >= and <= operators can also be used, & behave as expected : REM string comparison is case-sensitive by default, and BBC BASIC REM does not provide built-in functions to convert to all upper REM or all lower case; but it is easy enough to define one : IF FN_upper(shav$) = FN_upper(shakes$) THEN PRINT "The two strings are equal (disregarding case)" ELSE PRINT "The two strings are not equal (even disregarding case)" END : DEF FN_upper(s$) LOCAL i%, ns$ ns$ = "" FOR i% = 1 TO LEN s$ IF ASC(MID$(s$, i%, 1)) >= ASC "a" AND ASC(MID$(s$, i%, 1)) <= ASC "z" THEN ns$ += CHR$(ASC(MID$(s$, i%, 1)) - &20) ELSE ns$ += MID$(s$, i%, 1) NEXT = ns$