アットウィキロゴ

katuuii

package park;
 
import tool.*;
import java.io.*;
import java.io.File;
 
public class pro {
int s,datanumber;
String[] data=new String[500];
   int number;
String[][] y=new String[500][50];
  String[] subdata=new String[50000];
 
 
    public static void main(String[] args) {
        pro t=new pro();
    }
    pro(){
 
        File f=new File("data");
        String[] ff=f.list();
 
        int tx=0;
        int de;
        for(de=0;de<ff.length;de++){
 
        readfile sub4=new readfile();
       sub4.makedata("data/"+ff[de],"UTF-8");
        data=sub4.data;
        datanumber=sub4.datanumber;
 
 
 
        int sx;
        String[] x1=data[1].split(",");
        number=x1.length;
        for(s=2;s<datanumber+1;s++){
        String[] x=data[s].split(",");
       int n=x.length;
       y[s][0]=x[0];
        for(sx=1;sx<x.length;sx++){ 
        if(n==number)y[s][sx]=x[sx];
        }
        if(n==number-1)y[s][1]=y[s-1][1];
        for(sx=1;sx<x.length;sx++){ 
        if(n==number-1)y[s][sx+1]=x[sx];
        }
        }
 
        System.out.println(de+","+datanumber); 
 
        String c=ff[de].replace(".csv","");
 
         for(s=2;s<datanumber+1;s++){
        tx=tx+1;
        String str=c;
        for(sx=0;sx<number;sx++){
        str=str+","+y[s][sx];
        }
        subdata[tx]=str;
        }
 
 
        }
 
  datanumber=tx;      
 
  writexml("ren.csv");      
 
 
    }
 
     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(subdata[s]);  
}
 
 
System.out.println("ファイルに書きこみました。"); 
pw.close(); 
} catch(IOException ep){ System.out.println("入出力エラーです。"); } 
 
 
} 
 
 
}
 
最終更新:2017年08月21日 15:45