Amos Professional Manual  Contents  Index

String Functions


     POS=Match(D$(0),A$)
     If POS<-N-1
        If POS>-10
           Print "Not found. Nearest to ";D$(1) : Goto JMP
        Else
           Print "Not found. Nearest to ";D$(N) : Goto JMP
        End if
     End If
     If POS>0 Then Print "Found ",DS(POS);" in record ";POS
     If POS<0 Then Inc POS : Print "Not found. Nearest to ":DS(Abs(POS))
     JMP:
    Loop
    Data 8,"Mercury","Venus","Earth","Mars","Saturn","Jupiter","Neptune","Tharg"

Test that example out by entering various inputs, including the names of planets, single characters in upper and lower case and "print all data". Obviously MATCH can be used with the INSTR function to set up a powerful parser routine, for interpreting user input in an adventure game.

Back    Next
05.02.07