[RESOLVED] Line Input doesn't like the "Like" operator?
Hey, I have a real annoying problem. Ha ha.
I'm trying to read a text document and search for a line in this format:
Code:
#CLIP {NAME} {LOOP}
But when I use the code:
Code:
If strBuffer Like "#CLIP * *" Then
It will never find the line in the text document.
I have tried changing lots of lines of code, but nothing works...
It will work if I change it to:
Code:
If strBuffer = "#CLIP TEST True" Then
But that isn't what I want...
Does anyone know what my problem is?
Re: Line Input doesn't like the "Like" operator?
you could use instr
vb Code:
if instr(strbuffer, "#CLIP") > 0 then ' found
# is special in LIKE and has to be escaped, this would work, using wildcard to replace #
If strbuffer Like "?CLIP * *" Then
Re: Line Input doesn't like the "Like" operator?
I think you may need to use Regular expression for that. If you only want to find lines that start with #CLIP then you can try LEFT$.
Re: Line Input doesn't like the "Like" operator?
With Like operator, # denotes a digit. Your line text contains litteral character "#" not a digit (0-9).
Change it to:
... Like "[#]CLIP * *"
Re: Line Input doesn't like the "Like" operator?
Thanks heaps.
I had no idea that it represented that.
That also answers my other question. Ha ha.
Thanks guys.