Fiddling around with INSTR I encountered a bug regarding right to left searching.
Following program shows that the nth occurrence of "+" found at its correct position
searching from left to right. Doing this from right to left it just fails.
But may be I am missing something.
Uses "Console"
' string with plus character at indexes 5, 10, 15 and 20
Dim test$ Value "----+----+----+----+"
' find from first index to right
PrintL "Expect 5, get", InStr(1, test$, "+", 1)
PrintL "Expect 10, get", InStr(1, test$, "+", 2)
PrintL "Expect 15, get", InStr(1, test$, "+", 3)
PrintL "Expect 20, get", InStr(1, test$, "+", 4)
PrintL
' find from last index to left
PrintL "Expect 20, get", InStr(-1, test$, "+", 1)
PrintL "Expect 15, get", InStr(-1, test$, "+", 2)
PrintL "Expect 10, get", InStr(-1, test$, "+", 3)
PrintL "Expect 5, get", InStr(-1, test$, "+", 4)
WaitKey