可以用一个正则去匹配,只要find()为true,取出group()就是你想要的数据了

解决方案 »

  1.   

    用substring啊,把内容读进来,然后放到String中,然后截取,截取完后在放到另一个文件中
      

  2.   

    提供读取和写入文件的代码public static String readFile(String path)
    {
        String str = "";
        File file = new File(path);
        BufferedReader reader = null;
        try {
         reader = new BufferedReader(new FileReader(file));
         String tempString = null;
         String br= System.getProperty("line.separator");
         while ((tempString = reader.readLine()) != null) {
         // 这里可以去判断下楼主自己写
                 //............
          str = str+ tempString+br;
         }
         reader.close();
        } catch (IOException e) {
         e.printStackTrace();
        } finally {
         if (reader != null) {
          try {
           reader.close();
          } catch (IOException e1) {
          }
         }
        }
       
         return str;
    }

    public static void writeToFile(String filePath, String sets) throws IOException {
        FileWriter fw = new FileWriter(filePath);
        PrintWriter out = new PrintWriter(fw);
        out.write(sets);
        out.println();
        fw.close();
        out.close();
       }