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[5][50];
int number;
public static void main(String[] args) {
pro t=new pro();
}
pro(){
int tr;
for(tr=1;tr<254;tr++){
readfile sub=new readfile();
sub.makedata("p/"+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;
for(s=1;s<3;s++){
String[] y=x[s].split("</td>");
team[s]=y[0].replace("<tr><td class=\"team\">","");
team[s]=team[s].replace(" ","");
number=y.length-1;
for(sx=1;sx<y.length;sx++){
point[s][sx]=y[sx].replace("<td>","");
}
point[s][number]=point[s][number].replace("<td class=\"totalScore\">","");
}
writexml("score_p/"+tr+".txt");
}
}
void writexml(String file){
int s,sx;
try{
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file)));
for(s=1;s<3;s++){
pw.print(team[s]);
for(sx=1;sx<number+1;sx++){
pw.print(",");
pw.print(point[s][sx]);
}
pw.println("");
}
System.out.println("ファイルに書きこみました。");
pw.close();
} catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
}
最終更新:2016年06月20日 02:31