アットウィキロゴ

miha

package hou;
 
import tool.*;
 
import java.io.*;
 
public class pro {
int s,datanumber;
String[] data=new String[50000];
String[] name=new String[50000];
String[] city=new String[50000];
String[] party=new String[50000];
int[] point=new int[500000];
  int number_city=0;
 
int number;
String[] town=new String[5000];
String[] code=new String[50000];
 
String[] v=new String[50000];
String[][] vs=new String[200][500];
  int dicnumber=0;
        String[] link=new String[500];
public static void main(String[] args) {
        pro t=new pro();
    }
    pro(){
 
 
 
 
 
 
 
 
 
 
 
         getdata sub=new getdata();
        sub.makedata("http://history.wbsrv.net/","UTF-8");
        data=sub.data;
        datanumber=sub.datanumber;
 
        String str="";
        for(s=1;s<datanumber+1;s++){
        str=str+data[s];
 
        } 
 
 
        String[] x=str.split("</tr>");
     int sx;
         for(s=1;s<x.length-1;s++){
 
    String[] y=x[s].split("</td>");
    link[s]=y[0];
    int p1=link[s].indexOf("http");
    int p2=link[s].indexOf("\"",p1);
    if(p1>-1)link[s]=link[s].substring(p1,p2);
 
         for(sx=0;sx<y.length;sx++){
 
             if(sx==0)name[s]=change(y[sx]);
          if(sx==1)city[s]=change(y[sx]);
          if(sx==2)code[s]=change(y[sx]);
          if(sx==3)town[s]=change(y[sx]);
          if(sx==4)v[s]=change(y[sx]);
          if(sx==5)party[s]=change(y[sx]);
        System.out.println(sx+y[sx]);
         }
         }
 
         number=x.length;
 
 
 writexml("ren.txt");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
    }
     String change(String str){
 
        int n;
        for(n=1;n<15;n++){
        str=rev(str);    
        }
 
        str=str.replace(" ","");
 
        return str;
    }
 
 String rev(String str){
 
        if(str==null)str="";
 
        int p1=str.indexOf("<");
        int p2=str.indexOf(">",p1);
        String strx="";
        if(p2>-1)strx=str.substring(p1,p2+1);
        str=str.replace(strx,"");
 
        return str;
    }    
 
 
 
       void writexml(String file){ 
 
    int s,sx;
 
try{ 
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file))); 
 
for(s=1;s<number-1;s++){ 
pw.print(name[s]); 
pw.print(","); 
pw.print(link[s]); 
pw.print(","); 
pw.print(city[s]); 
pw.print(","); 
pw.print(code[s]);  
pw.print(","); 
pw.print(town[s]); 
pw.print(","); 
pw.println(v[s]);  
 
}
 
 
System.out.println("ファイルに書きこみました。"); 
pw.close(); 
} catch(IOException ep){ System.out.println("入出力エラーです。"); } 
 
 
} 
 
 
    double num(String str){
 
    double nx;
 
    nx=0;
 
 try{
 
    nx=Double.parseDouble(str);
 
 }catch (Exception e) {}
 
 return nx;
 
 
 
}
 
 
}
最終更新:2016年08月22日 11:04