package base;
import tool.*;
import java.io.*;
public class pro {
int s,datanumber;
String[] data=new String[6000];
String[] num=new String[6000];
String[] name=new String[6000];
String[] age=new String[6000];
String[] school=new String[6000];
String[] h=new String[6000];
String[] w=new String[6000];
String[] car=new String[6000];
String[] bat=new String[6000];
int number;
String[] namex=new String[6000];
String[] link=new String[6000];
public static void main(String[] args) {
pro r=new pro();
}
pro(){
int tr=1;
for(tr=1;tr<13;tr++){
readfile sub7=new readfile();
sub7.makedata("gdata/"+tr+".txt","UTF-8");
data=sub7.data;
datanumber=sub7.datanumber;
int sx=0;
for(s=1;s<datanumber+1;s++){
String[] x=data[s].split(",");
if(x.length>4){
sx=sx+1;
num[sx]=x[0].replace(" ","");;
name[sx]=x[1];
h[sx]=x[4].replace(" ","");
w[sx]=x[5].replace(" ","");;
school[sx]=x[7].replace(" ","");;
bat[sx]=x[2].replace(" ","");;
age[sx]=x[3].replace(" ","");;
car[sx]=x[6].replace(" ","");;
}
}
number=sx;
for(s=1;s<number+1;s++){
int p1=name[s].indexOf(">");
int p2=name[s].length();
namex[s]=name[s].substring(p1+1,p2);
namex[s]=namex[s].replace(" ","");
}
for(s=1;s<number+1;s++){
int p1=name[s].indexOf("=");
int p2=name[s].indexOf(">");;
link[s]=name[s].substring(p1+2,p2-1);
}
writexml("mem/"+tr+".txt");
}
}
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(num[s]);
pw.print(",");
pw.print(namex[s]);
pw.print(",");
pw.print(link[s]);
pw.print(",");
pw.print(bat[s]);
pw.print(",");
pw.print(age[s]);
pw.print(",");
pw.print(car[s]);
pw.print(",");
pw.print(h[s]);
pw.print(",");
pw.print(w[s]);
pw.print(",");
pw.println(school[s]);
}
System.out.println("ファイルに書きこみました。");
pw.close();
} catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
}
最終更新:2016年06月24日 05:52