01.03.2016, 16:13
Example concept code:
EDIT: Tested, prints "**** you *****".
EDIT EDIT: The following code would censor everything except the first character:
Output: "f*** you b*****"
EDIT EDIT EDIT: Added ignore case...
Код:
#include <a_samp> main() { new badwords[][] = {"fuck", "bitch"}; new input[] = "fuck you bitch"; // whatever string you want to test print(input); for (new i, pos; i < sizeof badwords; i++) while ((pos = strfind(input, badwords[i], true), pos) != -1) for (new p; p < strlen(badwords[i]); p++) input[pos + p] = '*'; print(input); }
EDIT EDIT: The following code would censor everything except the first character:
Код:
#include <a_samp> main() { new badwords[][] = {"fuck", "bitch"}; new input[] = "fuck you bitch"; // whatever string you want to test print(input); for (new i, pos; i < sizeof badwords; i++) while ((pos = strfind(input, badwords[i], true), pos) != -1) for (new p; p < strlen(badwords[i]) - 1; p++) input[pos + p + 1] = '*'; print(input); }
EDIT EDIT EDIT: Added ignore case...