Topic : The GFA-Basic Compendium Author : GFA Systemtechnik GmbH Version : GFABasic.HYP v2.98 (12/31/2023) Subject : Documentation/Programming Nodes : 899 Index Size : 28056 HCP-Version : 3 Compiled on : Atari @charset : atarist @lang : @default : Document not found @help : Help @options : +g -i -s +z @width : 75 @hostname : STRNGSRV @hostname : CAB @hostname : HIGHWIRE @hostname : THING View Ref-FileINSTR(a$,b$) INSTR(a$,b$[,x]) INSTR([x,]a$,b$) a$, b$: sexp x: iexp The function INSTR() searches the character string a$ for an occurrence of the string b$. If x is specified, then the search begins at character position x in a$, otherwise the whole string is searched. If b$ is found within a$, the character position at which it begins is returned, or, if it is not found the function returns zero (0). This value may be assigned to a variable or used to determine whether a particular string was present in a$. If a$ and b$ are both null strings (""), one (1) is returned. The search goes from left to right. Example: a$="GFA-Systemtechnik" x=INSTR(a$,"System") PRINT x,INSTR("GFA-BASIC","BASIC",6) --> The numbers 5 and 0 appear on the screen. REPEAT a$=123456" b$=INKEY$ UNTIL INSTR(a$,b$) --> Waits until one of the specified keys has been pressed. Memo: INSTR() has a bug which only appears if parameter 'x' is used. Use the following code listing instead: FUNCTION instr(a$,b$,i&) $F% LOCAL v& v&=INSTR(a$,b$,i&) IF v&<i& !bug? v&=0 ENDIF RETURN v& ENDFUNC