0
에 계산에 대해 내가 txt 파일
MYFILE.TXT자바 : 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);
작동합니까, 여러 단어 수 있습니까? 예 : count "ABC", "EFG" – heyman
@heyman "단어"가 무엇인지 구분하거나 정의 할 수 있습니까? – Kevin
String.contains는 라인에 특정 세트가 들어 있는지 확인합니다. – Kevin