' String Pattern — LIKE pattern matching and character checks
#COMPILE EXE
#DIM ALL

FUNCTION PBMAIN() AS LONG
    LOCAL text AS STRING
    LOCAL t1 AS STRING
    LOCAL t2 AS STRING
    LOCAL t3 AS STRING

    text = "Hello123World"
    PRINT "Source string: " + text
    PRINT

    IF text LIKE "*123*" THEN
        PRINT "LIKE *123* : Match (contains 123)"
    END IF

    IF text LIKE "Hello*" THEN
        PRINT "LIKE Hello* : Match (starts with Hello)"
    END IF

    IF LEN(text) = 11 THEN
        PRINT "LEN check: text is 11 characters"
    END IF

    IF NOT (text LIKE "[0-9]*") THEN
        PRINT "LIKE [0-9]* : No match (does not start with digit)"
    END IF

    PRINT

    t1 = "apple"
    t2 = "banana"
    t3 = "cherry"
    PRINT "Tokens: " + t1 + ", " + t2 + ", " + t3

    FUNCTION = 0
END FUNCTION
