Posted: 06:15pm 05 Nov 2015 |
Copy link to clipboard |
 Print this post |
|
I am trying to write a small function which will tell me if a particular character is present in a string. The function is to return the position of the first occurrence or 0 if NOT present.
I am getting the following error "Error: Unexpected text"!
Can someone shed some light on what I am doing wrong please.
list
Test$ = ">06-11-2015~15:09:21,367,396,366,346,0,321,<"
Print contains(Test$,">")
Print contains(Test$,">")
Function Contains(ThisStr$,Char$)
Local i
For i = 1 To Len(ThisStr$)
If Mid$(ThisStr$,i,1) = Char$ Then Return i
Next
Return 0
End Function
> ? mm.ver
4.07
> run
[12] If Mid$(ThisStr$,i,1) = Char$ Then Return i
Error: Unexpected text
>
Rob White |