I am looking for a function that checks if a string follows (matches exactly) the pattern of data specified by the additional arguments corresponding to the format
string
Like this:
/* int strcmpf (char *str1, char *format, ...); */
char *test = "Hello World !"
if(!strcmpf(test, "%s%*s %c", "Hello ", '!')
return HELLO_HAS_BEEN_SAID;
else
return PROGRAM_ISNT_POLITE;
Implementing this myself I assume will be very difficult, but such function could be very useful for semantic parsing of content. Before I attempt to write such function myself, I need to know if there is already a library or code snippet that provides implementation of a function like this ?
To be more specific, I need pattern-matching behavior. So test
must match exactly the pattern specified by the data corresponding to the format
parameter.