アットウィキロゴ

cごう

package p;
public class pro {
 
 
    int s,datanumber;
    String[] data=new String[50000];
   String[] year=new String[50000];
     String[] v=new String[50000];
    int number;
 
    public static void main(String[] args) {
        pro t=new pro();
    }
    pro(){
 
       String urlx=" https://opendata.resas-portal.go.jp/api/v1/municipality/foundation/perYear?cityCode=11362&prefCode=11";
 
 
          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];
 
   }
 
   int p3=str.indexOf("\"data");
   str=str.substring(p3,str.length());
 
System.out.println(str);  
 
   String[] x=str.split("},");
   for(s=0;s<x.length;s++){
   int p1=x[s].indexOf("year");
   p1=x[s].indexOf(":",p1);
   int p2=x[s].indexOf(",",p1+2);
   year[s+1]= x[s].substring(p1+1,p2);
   p1=x[s].indexOf("value");
   p1=x[s].indexOf(":",p1);
   p2=x[s].length();
   v[s+1]= x[s].substring(p1+1,p2);
   v[s+1]=v[s+1].replace("}","");
    v[s+1]=v[s+1].replace("]","");
   System.out.println(year[s+1]+","+v[s+1]);
   }
 
 
   number=x.length; 
 
 
 
 
 
 
    }
 
 
 
 
 
    }
最終更新:2017年03月03日 03:59