POS() Function  Scan a String
Syntax
POS(stringA relation stringB {{,intA},intB})
Description
The POS() function scans stringB for a substring with a specific relationship to stringA.
Parameter 
Description 
stringA 
String sought. 
relation 
Relational operator, which can be one of the following: = Equal to <> Not equal to < Less than <= Less than or equal to >Greater than >= Greater than or equal to 
stringB 
String to be scanned. 
intA 
Search interval. 
intB 
Occurrence of
the desired substring. 
If the relation condition is satisfied, POS() returns the position of
the first character in stringB
of the matched substring. If the search fails, POS() returns zero.
POS() follows these logic steps:

If stringA or stringB is null, return 0.

Start with the first byte in stringB if intA is positive, or the Nth byte from the end of stringB if intA is negative (N).

If past either the beginning or end of stringB, return 0 (or occurrence count if intB is 0).

Compare stringA with the substring at the current position in stringB. The length of the substring will be either the length of stringA or the remainder of stringB, whichever is shorter.

If the given relation is true, and if this was the Nth successful try (specified by intB=N), then return the current scan position.

If the relation was not satisfied, then bump the scan position (backwards if intA is negative), go to step 3, and try again.
Examples
>A$="MONTUEWEDTHUFRISATSUN"
>PRINT POS("WED"=A$)
7
>PRINT POS("ON"=A$)
2
>PRINT POS("ON"=A$,3)
0
>PRINT POS("SAT"<A$)
4
1000 REM  remove trailing spaces from A$
1010 LET A$=A$(1,POS(" "<>A$,1))