package golden;
public class pro {
String[] name=new String[4000];
String[] term=new String[4000];
String[] time=new String[4000];
int number;
String[] termx=new String[4000];
int[] year=new int[6000];
int[] month=new int[6000];
int[] years=new int[6000];
int[] months=new int[6000];
public static void main(String[] args) {
pro t=new pro();
}
pro(){
smap sub=new smap();
sub.makedata();
name=sub.name;
number=sub.number;
time=sub.time;
term=sub.term;
termx=sub.termx;
int s;
for(s=1;s<number+1;s++){
String[] x=term[s].split("/");
int y1=0;
int m1=0;
if(x.length>2){
y1=numx(x[0]);
m1=numx(x[1]);
}
String strx=term[s].replace("年","△");
strx=strx.replace("月","△");
String[] y=strx.split("△");
if(y.length>1){
y1=numx(y[0]);
m1=numx(y[1]);
if(y[0].indexOf("同")>-1)y1=year[s-1];
}
year[s]=y1;
month[s]=m1;
}
for(s=1;s<number+1;s++){
String[] x=termx[s].split("/");
int y1=0;
int m1=0;
if(x.length>2){
y1=numx(x[0]);
m1=numx(x[1]);
}
if(termx[s].indexOf("年")>-1){
String strx=termx[s].replace("年","△");
strx=strx.replace("月","△");
String[] y=strx.split("△");
if(y.length>1){
y1=numx(y[0]);
m1=numx(y[1]);
if(y[0].indexOf("同")>-1)y1=year[s];
}
}
int h=0;
if(termx[s].indexOf("月")>-1)h=h+1;
if(y1==0)h=h+1;
if(h==2){
String strx=termx[s].replace("年","△");
strx=strx.replace("月","△");
String[] y=strx.split("△");
m1=numx(y[0]);
y1=year[s];
}
years[s]=y1;
months[s]=m1;
}
for(s=1;s<number+1;s++){
System.out.println(name[s]+","+time[s]+","+year[s]+","+month[s]+","+years[s]+","+months[s]);
}
}
int numx(String str){
int nx;
nx=0;
try{
nx=Integer.parseInt(str);
}catch (Exception e) {}
return nx;
}
}
package golden;
import tool.*;
public class smap{
int s,datanumber;
String[] data=new String[4000];
String[] name=new String[4000];
String[] term=new String[4000];
String[] time=new String[4000];
int number;
String[] termx=new String[4000];
void makedata(){
String str1="%20";
String id="1ksBKMp2qvxtiMr9168ryQcnODDqHT_koBiSQX8IS";
String urlx="https://www.googleapis.com/fusiontables/v1/query?sql=SELECT";
urlx=urlx+str1+"*"+str1+"FROM"+str1+id;
urlx=urlx+"&key=AIzaSyAH0WCAXRIdHdbI-6bnMSN4kVDDZZmGyqY";
getdata sub=new getdata();
sub.makedata(urlx,"UTF-8");
data=sub.data;
datanumber=sub.datanumber;
String str="";
for(s=1;s<datanumber+1;s++){
str=str+data[s];
}
str=str.replace("\"rows\": ","");
String[] x=str.split("],");
for(s=1;s<x.length;s++){
String[] y=x[s].split(",");
name[s]=y[0];
time[s]=y[1];
term[s]=y[2];
termx[s]=y[3];
}
for(s=1;s<x.length;s++){
name[s]=cg(name[s]);
term[s]=cg(term[s]);
time[s]=cg(time[s]);
termx[s]=cg(termx[s]);
}
number=x.length-1;
}
String cg(String c){
int p1=c.indexOf("\"");
int p2=c.indexOf("\"",p1+1);
c=c.substring(p1+1,p2);
return c;
}
}
最終更新:2016年09月08日 09:09