I have several possible occurrences to test with strstr
.
if ((a = strstr(string, "FOO")) != NULL || (a = strstr(string, "BAR")) != NULL ||
(a = strstr(string, "FOO2")) != NULL ||(a = strstr(string, "BAR2")) != NULL ||
(a = strstr(string, "FOO3")) != NULL ||(a = strstr(string, "BAR3")) != NULL) // do something
and then based on the occurrence found I need to do
var = strlen("THE_ONE_MATCHED_ABOVE");
What would be a good way to do this without using lots of if statements?