我想计算 txt 文件
myfile.txt中的一些单词
ABC,xyzwegwegwe
ABC,12312312312
ABC,sdfsdf3sdfs
我怎么数“ABC”这个词?
输出:"ABC" have: 3
while (myfile.hasNextLine()) {
line = myfile.nextLine();
lines.add(line);
if(xxxxx){ //if have ABC, words++
words++;
}
}
System.out.print("\"ABC\" have: "+words);