?? cvsfile.java
字號(hào):
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package swoosh;import parser.*;import java.io.*;import java.util.*;import java.io.BufferedReader;import java.io.File;import java.io.FileNotFoundException;import java.io.FileReader;import java.io.FileWriter;import java.io.IOException;/** CSV in action: lines from a file and print. */public class CVSFILE { public static void main(String[] args) throws IOException { CSV csv = new CSV(); String arquivo="teste.cvs"; BufferedReader in = new BufferedReader(new FileReader("src/parser/teste.cvs")); ArrayList row =process(csv, in); swoosh s=new swoosh(row); s.swoosh_execu?ao(); } protected static String[] buildStringTokens(String s) { String[] result = new String[s.length()]; for (int i = 0; i < s.length(); i++) { result[i] = s.substring(i, i + 1); } return result; } protected static ArrayList process(CSV csv, BufferedReader is) throws IOException { String line; ArrayList row = new ArrayList(); ArrayList records = new ArrayList(); int i=1; while ((line = is.readLine()) != null) { System.out.println("line = `" + line + "'"); Iterator e = csv.parse(line).iterator(); records.add(String.valueOf(i) ); i++; while (e.hasNext()) { line=(String )e.next(); line=line.replaceAll(" ", ""); records.add(line); } row.add(records); records=new ArrayList(); } imprime_lista(row); return(row); } protected static void imprime_lista(ArrayList list) { int i,j; for(i = 0; i < list.size(); i++ ) { ArrayList p = (ArrayList)list.get(i); System.out.println(""); for (j = 0; j < p.size(); j++) { System.out.print(" " + p.get(j).toString()); } } } }
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -