POS function.
More powerfull then you thought.
Look at the following routine:
0010 begin
0020 dim A[1:5],A$[1:5]
0030 let A$[1]="alfa "
0040 let A$[2]="bravo "
0050 let A$[3]="charlie "
0060 let A$[4]="delta "
0070 let A$[5]="echo " !Spaces for readability only.
0075 print A${all}
0080 let A{all}=pos("a"=A${all})
0090 print A{all}
0100 let A{all}=pos("a"=A${all},1,0)
0110 print A{all}
The numberarray is the result of the 'POS' function from the stringarray
A[1]=pos("a"=A$[1])
A[2]=pos("a"=A$[2])
.....
A[n]=pos("a"=A$[n])
And ... did you know this one ?
PRINT POS ( "abc" : "Scissor" )
Please note that we use a colon (:) instead of the equal (=) sign.
We are looking for an 'a' or 'b' or 'c' in the string 'Scissor'.
The result is the position of the first matching character in the string.
In this case, the first matching character is a c' at the second position.
Subsequently, the result is '2'.
Or:
PRINT POS ( "abc" ^ "Scissor" )
We now check the position with a character not matching the characters 'a' or 'b'
or 'c'. In this case it is the very first position with the character 'S'.
Subsequently, the result is '1'
