package book;
import java.io.*;
public class pro {
String[] data=new String[60000];
int s,datanumber;
double[][] p=new double[600][21];
public static void main(String[] args) {
pro t=new pro();
}
pro(){
readx("c.csv");
int sx;
for(s=2;s<datanumber+1;s++){
data[s]=rev_csv(data[s]);
String[] x=data[s].split(",");
for(sx=0;sx<x.length;sx++){
double n1=num_double(x[sx]);
p[s-1][sx+1]=n1;
}
}
datanumber=datanumber-1;
for(s=1;s<datanumber+1;s++){
System.out.println(p[s][1]);
}
}
String rev_csv(String str){
String str5=str;
int px=str5.indexOf("\"");
while(px>-1){
str5=rev(str5);
px=str5.indexOf("\"");
}
return str5;
}
String rev(String str){
int p1=str.indexOf("\"");
int p2=str.indexOf("\"",p1+1);
String str1=str.substring(0,p1);
String str2=str.substring(p1+1,p2);
String str3=str.substring(p2+1,str.length());
str2=str2.replace(",","");
return str1+str2+str3;
}
double num_double(String str){
double nx;
nx=0;
try{
nx=Double.parseDouble(str);
}catch (Exception e) {}
return nx;
}
void readx(String file){
String str;
BufferedReader br;
int s;
s=0;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8"));
while((str = br.readLine()) != null) {
s=s+1;
data[s]=str;
}
br.close();
} catch (IOException e) {System.out.println(e);}
datanumber=s;
}
}
最終更新:2017年02月03日 02:49