Hi
I've got comparable code:
Problem: I need a default case... I could solve it with a flag like this:Code:if (strstr(string, "Statement1") function1; if (strstr(string, "Statement2") function2; if (strstr(string, "Statement3") function3; if (strstr(string, "Statement4") function4;
or maybe like thisCode:if (strstr(string, "Statement1") { function1; flag=TRUE; } if (strstr(string, "Statement2") { function2; flag=TRUE; } .... if(!flag) { fuction_default; }
??Code:if (strstr(string, "Statement1") { function1; } else { if (strstr(string, "Statement2") { function2; } else { if (strstr(string, "Statement3") { function3; } else { if (strstr(string, "Statement4") { function4; } else { fuction_default; } } } }
I dont think its the best way... I suppose that a "switch - case statement" is unfortunately not possible because I need to search the string for many different char-strings...
How would you solve this problem?
thx in advance




Reply With Quote