아래 코드를 참조하십시오. 기본적으로 파일 형식을 확인하기 위해 특정 단어를 확인하고 있습니다. 아래에서 코드를 확인하고 이것이 최선의 방법인지 알고 싶습니다. 제안해라. 파일 이름이 TEMP _data.dat 코드를 전달합니다 이상도, 내가 찾고 있어요 정확한 단어,문자열의 특정 단어를 검색하는 방법
감사를 incoming_있다
Example File Name : incoming_EMP_data.dat
final String[] files = file.list();
if (files != null && files.length > 0) {
fileName = files[0];
if(files[0].replace("_"," ").indexOf("EMP")!=-1)
System.out.println("EMP file");
else
System.out.println("NOT EMP file");
}
경우
MKR
http://stackoverflow.com/questions/3057621/java-filenames-filter-pattern -이 기능을 살펴보십시오. – BatScream