package sc;
import tool.*;
import java.io.*;
public class pro {
int s,datanumber;
String[] data=new String[5000];
String[] team=new String[5];
String[][] point=new String[500][50];
int number;
public static void main(String[] args) {
pro t=new pro();
}
pro(){
int tr;
for(tr=1;tr<264;tr++){
readfile sub=new readfile();
sub.makedata("c/"+tr+".html","UTF-8");
data=sub.data;
datanumber=sub.datanumber;
int s1=0;
for(s=1;s<datanumber+1;s++){
if(data[s].indexOf("ホームチームの打席成績表")>-1)s1=s;
}
int s2=0;
for(s=s1;s<datanumber+1;s++){
int h=0;
if(data[s].indexOf("</table")>-1)h=h+1;
if(s2==0)h=h+1;
if(h==2)s2=s;
}
String str="";
for(s=s1;s<s2+1;s++){
str=str+data[s];
}
String[] x=str.split("</tr>");
int sx;
number=x.length;
for(s=1;s<number;s++){
String[] y=x[s].split("</td>");
for(sx=0;sx<21;sx++){
point[s][sx]="";
}
for(sx=0;sx<y.length;sx++){
point[s][sx]=y[sx].replace("<td>","");
}
}
writexml("home_c/"+tr+".txt");
}
}
void writexml(String file){
int s,sx;
try{
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file)));
for(s=1;s<number;s++){
pw.print(point[s][0]);
for(sx=1;sx<21;sx++){
pw.print(",");
pw.print(point[s][sx]);
}
pw.println("");
}
System.out.println("ファイルに書きこみました。");
pw.close();
} catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
}
最終更新:2016年06月20日 03:02