package neko;
import tool.*;
public class pro {
int s,datanumber;
String[] data=new String[5000];
String[] city=new String[5000];
int[] point=new int[5000];
public static void main(String[] args) {
pro tes=new pro();
}
pro(){
readfile sub=new readfile();
sub.makedata("datax.csv","UTF-8");
data=sub.data;
datanumber=sub.datanumber;
int sx;
for(s=1;s<datanumber+1;s++){
data[s]=scan(data[s]);
String[] x=data[s].split(",");
city[s]="";
point[s]=0;
for(sx=0;sx<x.length;sx++){
if(sx==0)city[s]=x[sx];
if(sx==2)point[s]=numx(x[sx]);
}
System.out.println(city[s]+","+point[s]);
}
}
String scan(String str){
int tr;
String strx=str;
for(tr=1;tr<41;tr++){
strx=plan(strx);
}
strx=strx.replace("\"","");
return strx;
}
String plan(String str){
int p1=str.indexOf("\"");
int p2=str.indexOf("\"",p1+1);
String a1="";
String a2="";
String a3="";
if(p2>-1)a1=str.substring(0,p1);
if(p2>-1)a2=str.substring(p2+1,str.length());
if(p2>-1)a3=str.substring(p1+1,p2);
a3=a3.replace(",","");
String strx=str;
if(p2>-1)strx=a1+a3+a2;
return strx;
}
int numx(String str){
int nx;
nx=0;
try{
nx=Integer.parseInt(str);
}catch (Exception e) {}
return nx;
}
}
最終更新:2016年04月12日 19:09