比如一个CSV文件是这样:标题1 1111
标题2 2222
标题3 3333
标题4 4444
标题5 5555
标题6 6666写一代码取出里面的标题1-标题6其它的不要.....(并且不能乱码,用UTF-8的) public static void main(String[]args) throws Exception{ String tempStr = "";
String strLine[] = null;
BufferedReader br = null;
try{
br = new BufferedReader(new FileReader("D:/test.csv"));
}catch(FileNotFoundException e){
System.out.println("File Is Not exists");
}
if(br != null){
while((tempStr = br.readLine()) != null){
strLine = tempStr.split(",");
//retStr = retStr + "|" + strLine[0];
System.out.println(strLine[0]);
}
}
}上面是我自己写的,读出来的乱码,而且好像也不是我想要的....所以请求各位帮忙..
标题2 2222
标题3 3333
标题4 4444
标题5 5555
标题6 6666写一代码取出里面的标题1-标题6其它的不要.....(并且不能乱码,用UTF-8的) public static void main(String[]args) throws Exception{ String tempStr = "";
String strLine[] = null;
BufferedReader br = null;
try{
br = new BufferedReader(new FileReader("D:/test.csv"));
}catch(FileNotFoundException e){
System.out.println("File Is Not exists");
}
if(br != null){
while((tempStr = br.readLine()) != null){
strLine = tempStr.split(",");
//retStr = retStr + "|" + strLine[0];
System.out.println(strLine[0]);
}
}
}上面是我自己写的,读出来的乱码,而且好像也不是我想要的....所以请求各位帮忙..
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货