문제가 있습니다. 텍스트를 분리하려고합니다. (예 : city # country # capitalcityname : 예 : Krakow # Poland # Warsaw) # 뒤에 어떻게 텍스트를 나눌 수 있습니까? 텍스트를 테이블에 넣고 싶습니다. 좋은 생각입니까? 텍스트를 뱉어 내고 테이블에 추가하기
public class WordSearch {
ArrayList<String> list= new ArrayList<>();
public WordSearch(){
try {
File file = new File ("songs.txt");
BufferedReader br = new BufferedReader(new FileReader(file));
String line = null;
while((line = br.readLine()) != null) {
list.add(line);
// System.out.println(line);
}
} catch (IOException e) {
System.out.println(e.getLocalizedMessage());
}
}
public ArrayList<String> getList() {
return list;
}
}
는 더 명확 나는 테이블
StringTokenizers에 모습 – Coderchu
@d_ominic 유무 : 왜 너는 심지어 오라클은 당신이 사용하지 않을 것을 권장합니까? 거의 항상'String # split (String regex)'를 대신 사용합니다. –
원래의 포스터에는 "테이블"이 무엇을 의미합니까? –