Scanner scan = new Scanner(new File("english.txt"));
scan.useDelimiter("(?i)([,\\.,。\\!!《》、;\\:;:\\s]+|and|of)");
while(scan.hasNext()){
System.out.println(scan.next());
}
String s= "hello world ? heheh java,";
String str = s.replaceAll("and", "");//去and
str=str.replaceAll("of", "");//去of
str=str.replaceAll(",", "");//去,
str=str.replaceAll(".", "");//去.
String[]ss =str.split(" ");//按空格分成数组
//上边这部分如有遗漏自己加
//遍历数组输出
for(int i=0 ;i
System.out.println(ss[i]);
}