有一个csv文件,有两列,我想用BufferedReader来读出第一列,求核心代码,万分感谢!!!
------解决方案--------------------
- Java code
import java.io.BufferedReader;import java.io.FileReader;public class ReadCSV { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new FileReader("c:/2009.csv")); String line ; while((line = br.readLine())!=null){ System.out.println(line.split(",")[0]); } br.close(); }}
------解决方案--------------------
改成line.split(",.*")[0] 效率更高点