package cd;
import java.io.*;
public class pro {
int s,datanumber;
String[] data=new String[5000];
String[] name=new String[5000];
String[] code=new String[5000];
String[] imx=new String[5000];
public static void main(String[] args) {
pro r=new pro();
}
pro(){
int tr;
for(tr=12;tr<29;tr++){
readx("data/"+tr+".txt");
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>");
for(sx=0;sx<y.length;sx++){
y[sx]=change(y[sx]);
if(sx==0)str=tr+","+y[sx]+",";
if(sx==1)str=str+y[sx]+",";
if(sx==2)str=str+y[sx]+",";
if(sx==3)str=str+y[sx];
}
System.out.println(str);
}
}
}
void writexml(String file){
int s,sx;
try{
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file)));
for(s=1;s<datanumber+1;s++){
pw.println(data[s]);
}
System.out.println("ファイルに書きこみました。");
pw.close();
} catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
String change(String str){
int n;
for(n=1;n<11;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 readx(String file){
String str;
BufferedReader br;
int s;
s=0;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8"));
while((str = br.readLine()) != null) {
s=s+1;
data[s]=str;
}
br.close();
} catch (IOException e) {System.out.println(e);}
datanumber=s;
}
}
最終更新:2016年09月11日 03:34