package x2;
import tool.*;
import java.io.*;
public class pro {
int s,datanumber;
String[] data=new String[6000];
String[] credit=new String[6000];
String[][] point=new String[50][20];
int s1;
public static void main(String[] args) {
pro t=new pro();
}
pro(){
int tr;
for(tr=1;tr<254;tr++){
readfile sub7=new readfile();
sub7.makedata("pitch_p/"+tr+".txt","UTF-8");
data=sub7.data;
datanumber=sub7.datanumber;
String str="勝利,投手,勝利,敗戦,S,試合,回数,打者,球数,安打,三振,四球,死球,失点,自責,通算防御";
credit=str.split(",");
s1=0;
int sx;
for(s=1;s<datanumber;s++){
int h=0;
if(data[s].indexOf("line")>-1)h=h+1;
if(s1==0)h=h+1;
if(h==2)s1=s+1;
String[] x=data[s].split(",");
for(sx=0;sx<x.length;sx++){
x[sx]=x[sx].replace(" ", "△");
x[sx]=x[sx].replace("<td class=\"left\">", "");
x[sx]=x[sx].replace("<td class=\"line\">", "");
x[sx]=x[sx].replace("<tr>", "");
x[sx]=x[sx].replace("<td class=\"line left\">", "");
point[s][sx]=x[sx];
}
}
writexml("pp/"+tr+".txt");
}
}
void writexml(String file){
int s,sx;
try{
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file)));
for(s=1;s<datanumber;s++){
pw.print("<team>");
if(s<s1)pw.print("home");
if(s>s1-1)pw.print("visit");
pw.print("</team>");
for(sx=0;sx<16;sx++){
pw.print("<");
pw.print(credit[sx]);
pw.print(">");
pw.print(point[s][sx]);
pw.print("</");
pw.print(credit[sx]);
pw.print(">");
}
pw.println("");
}
System.out.println("ファイルに書きこみました。");
pw.close();
} catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
}
最終更新:2016年06月24日 15:54