' String Processor — Text processing with SPLIT/JOIN/REPLACE
#COMPILE EXE
#DIM ALL

FUNCTION PBMAIN() AS LONG
    LOCAL text AS STRING
    LOCAL words() AS STRING
    LOCAL i AS LONG
    LOCAL joined AS STRING
    LOCAL replaced AS STRING

    text = "apple,banana,cherry,date"

    PRINT "Original: "; text

    SPLIT text, "," INTO words()

    PRINT "Split parts:"
    FOR i = 1 TO 4
        PRINT "  "; i; ": "; words(i)
    NEXT i

    joined = JOIN$(words(), " | ")
    PRINT "Joined: "; joined

    REPLACE "cherry" WITH "coconut" IN text
    PRINT "Replaced: "; text

    FUNCTION = 0
END FUNCTION
