I'm making an algorithm to find a pattern in a text. This pattern can include numbers and strings. It's a bit like (s)scanf, but I keep looking if I can't find it at the beginning but I can't read/convert the pattern to variables yet. I also do 'type checking', because if the pattern specifies a byte value and the value in the text <0 or >255 then the pattern doesn't match. This all works fine, but here's the question?
Is there already some (possibly a standard) function that does this. So I can compare and see which one is faster?
Because I have the idea it's kinda slow. But then again if I time this function:
void stupidFunc( char * text )
while( *(text++) );
it is even slower than a call to scanf. And I don't use it in my pattern finding routine, I do most searching manually (thus slow?). Like: if ( *text == '%' ) and that sorts of things. But I do use strstr. Is this fast?
But enough of my rambling...
Any resources or links would be appriciated!