compairing a string to multiple strings
This is what I need to accomplish in seudocode
if (string != "this" or "that" or "this" or "that")
{
}
Id do it with 12 different or statements
if(string !="this" || string !="that" || ...etc){}
but Im wondering if there is a cleaner way to go about this.
[436 byte] By [
Sparkkya] at [2007-11-26 22:48:44]

String bla = "String4";
String[] checks = { "String1", "String2", "String3", ... };
boolean match = false;
for (int i = 0; i < checks.length; i++) {
if (checks[i].equals(bla)) {
match = true;
break;
}
}
if (match) {
}
Message was edited by:
Simeon
Message was edited by:
Simeon