處理字串的小程式

sunnylovecmc發表於2010-01-20


package com.yifi.test;

import java.io.*;
import java.util.*;

public class AutomakecodeNEOBOOK {

 /**
  * @param args
  */
 public static void main(String[] args) {
  Date t = new Date();
  long tt = t.getTime();
  System.out.println("程式開始:" + tt);
  // TODO Auto-generated method stub
  System.out.println(args[0]);

  try {
   String left = args[0];
   BufferedReader br = new BufferedReader(new InputStreamReader(
     new FileInputStream(args[1])));
   String data = null;
   System.out.println("------------start----------");
   while ((data = br.readLine()) != null) {
    // System.out.println(data);
    if (data.length() > 0) {
     System.out.println("if " + left + " /"=/" " + "/"" + data
       + "/"");
     System.out.println("顯示隱藏物體 /"0/" /"" + data + "/" /"0/"");
     System.out.println("endif");
    } else {
     System.out.println("");
    }
   }
   System.out.println("-------------end-----------");
  } catch (FileNotFoundException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (IOException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
  Date ta = new Date();
  long tend = ta.getTime();
  System.out.println("程式結束:" + tend + "/n" + (tend - tt) + "毫秒");
 }

}

 

相關文章