-
Notifications
You must be signed in to change notification settings - Fork 1
/
Blacklist.java
57 lines (37 loc) · 959 Bytes
/
Blacklist.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import java.util.ArrayList;
class Blacklist{
ArrayList <String> blkList = new ArrayList<String>();
protected Blacklist(){
this.blkList.add("fuck");
this.blkList.add("motherfucker");
this.blkList.add("motherfuck");
this.blkList.add("ass");
this.blkList.add("asshole");
this.blkList.add("asswhole");
this.blkList.add("shit");
this.blkList.add("bullshit");
this.blkList.add("prick");
this.blkList.add("bitch");
this.blkList.add("badword");
}
public void add(String str){
this.blkList.add(str);
}
public boolean containsBadWord(String str){
String tmp = "";
for(int i =0; i<str.length(); i++){
if(str.charAt(i) != '\0' &&str.charAt(i) != ' ' && str.charAt(i) != '\n'){
tmp += str.charAt(i);
}
if(i == (str.length()-1) || str.charAt(i) == ' '){
for(String s: blkList){
if(s.equals(tmp)){
return true;
}
}
tmp = "";
}
}
return false;
}
}