16.04.2012, 18:18
pawn Код:
remove_bad_word(text[]) {
static words[][32] = {"bla"};
static exceptions[][32] = {"vobla"};
for (new i, pos; i < sizeof(words); i++) {//check all words
while ((pos = strfind(text, words[i], true, pos)) != -1) {//if found
for (new j, inpos; j < sizeof(exceptions); j++) {//chec all exceptions
while ((inpos = strfind(exceptions[j], words[i], true)) != -1 ) {//check only exception with founded word
if (strfind(text, exceptions[j], true) != (pos - inpos)) {//this is not exception
return 1;//found word is bad word
} else {
break;//go to next exception
}
}
}
pos++;
}
}
return 0;
}