2008年12月13日星期六

Java Code

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

public class WSC_PJ {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
   try {
    //file IO lines, inp.txt is the input file, result.txt is the put file
       BufferedReader in = new BufferedReader(new FileReader("inp.txt"));
       BufferedWriter out = new BufferedWriter(new FileWriter("result.txt"));
             
       String str;
       while ((str = in.readLine()) != null) {
       
        //store the strings in the arraylist
        ArrayList<String> myArr = new ArrayList<String>();
         
        StringTokenizer st = new StringTokenizer(str);
       
        while (st.hasMoreTokens()){
        String temp_str=st.nextToken();
        temp_str=temp_str.replace(",", "");
       
           //System.out.println(temp_str);
        myArr.add(temp_str); //put all the informatin in the arraylist
                      
        }
       
        out.write("insert into cstb_item_desc values (");
       
        for(int i=0;i<myArr.size();i++){
       
        if(i==myArr.size()-1)
          out.write("'"+myArr.get(i)+"'"+");");
        else
          out.write("'"+myArr.get(i)+"'"+",");
        }
       
        out.write("\n");
       
       
       }
       
       in.close();
       out.close();
       
   } catch (IOException e) {
   
    System.out.println("Some error occurs!");
   }


}

}

1 条评论:

i love javascript 说...

专门路过,对了!
问个问题,你是从事j2ee开发的吗?
你觉得asp.net(c#)如何?
还有rails或是python?

你个人认为.net与java那个会相对来说好一点?我指的是WEB开发

不知道在国外这些语言或是技术的发展如何?
分享点意见吧