' String tokenizer
#COMPILE EXE
#DIM ALL
FUNCTION PBMAIN() AS LONG
    LOCAL s AS STRING
    LOCAL n AS LONG
    LOCAL i AS LONG
    s = "apple,banana,cherry"
    n = 1
    FOR i = 1 TO LEN(s)
        IF MID$(s, i, 1) = "," THEN n = n + 1
    NEXT i
    PRINT "Tokens: " + STR$(n)
    FUNCTION = 0
END FUNCTION
