REM
REM Contributed by James C. Fuller - April 2009.
REM
REM' bacon ExtractStr
FUNCTION ExtractStr(STRING Main$,STRING Delim$)
    LOCAL i TYPE int
    LOCAL sRet$ TYPE STRING
    sRet$=""
    IF (LEN(Main$) EQ 0) | (LEN(Delim$) EQ 0) THEN
         RETURN sRet$
    ENDIF
    i = INSTR(Main$,Delim$,1)
    IF i EQ 0 THEN
       RETURN Main$
    ENDIF
    RETURN LEFT$(Main$,i-1)
ENDFUNCTION

REM' ExtractStr Test
REM' ExtractStr(Main$,Delim$)
REM' Similar to LEFT$ but uses a delimiter rather tha position
REM' S1$ = ExtractStr("James C. Fuller"," ")
REM' PRINT S1$