' *** BIN_STR.LST *** 2nd GFA-Manual, page 5-6 > PROCEDURE bin_search_string(lowercase!,element$,VAR proc$(),index,ok!) ' ' *** Find element$ in sorted string-array with 'binary search' ' *** If lowercase!=TRUE, both lower and upper case characters are valid ' *** If lowercase!=FALSE, all characters are converted to upper case ' *** If successful, index of element$ is returned and ok!=TRUE ' LOCAL first,last,middle first=0 last=PRED(DIM?(proc$())) IF lowercase! WHILE firstproc$(middle) first=SUCC(middle) ELSE last=middle ENDIF WEND ok!=(proc$(first)=element$) ELSE element$=UPPER$(element$) WHILE firstUPPER$(proc$(middle)) first=SUCC(middle) ELSE last=middle ENDIF WEND ok!=(UPPER$(proc$(first))=element$) ENDIF IF ok! index=first ELSE index=0 ENDIF RETURN ' ********* '