-3
import java.io.*;

class FindFile {
   public static void main(String[] args) {
      File dir = new File("D:/Abhishek/src/com/siemens/med/hs/sf/payer/billing/claiminterface");
      FilenameFilter filter = new FilenameFilter() {
         public boolean accept
         (File dir, String name) {
            return name.indexOf("Claim");
             }
      };
      String[] children = dir.list(filter);
      if (children == null) {
         System.out.println("Either dir does not exist or is not a directory");
      } 
      else {
         for (int i=0; i< children.length; i++) {
            String filename = children[i];
            System.out.println(filename);
         }
      } 
   }
}
4

1 回答 1

1

我想你的意思更像

return name.toLowerCase().indexOf("claim") > -1;

在你的FileFilter课...

于 2013-06-21T07:08:47.360 回答