アットウィキロゴ

hidei

package shop;
 
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import tool.*;
 
 
public class pro {
 
    int s,datanumber;
    String[] data=new String[5000];
     String[] subdata=new String[5000];
  String[][] point=new String[200][500];
      String[] year=new String[5000];
    String[] credit=new String[5000];
     String[] month=new String[5000];
        String[] v=new String[5000];
  int number;
       String[] shop=new String[5000];
 
    public static void main(String[] args) {
        pro r=new pro();
    }
    pro(){
 
        int tr;
          int sx=0;
     for(tr=2008;tr<2016;tr++){   
 
 
        String file="data2/"+tr+".txt";
 
        readfile sub=new readfile();
        sub.makedata(file,"UTF-8");
        data=sub.data;
        datanumber=sub.datanumber;
 
 
        for(s=1;s<datanumber+1;s++){
        sx=sx+1; 
        data[s]=data[s].replace("tear","year");
        System.out.println(data[s]);
 
        catchword sub2=new catchword();
        year[sx]=sub2.makedata(data[s],"year");
       String str=sub2.makedata(data[s],"month");
       month[sx]=""+(Integer.parseInt(str)); 
       credit[sx]=sub2.makedata(data[s],"credit");
        shop[sx]=sub2.makedata(data[s],"name");
        v[sx]=sub2.makedata(data[s],"point");
          }
 
    }
 
     datanumber=sx;
 
 
        for(s=1;s<datanumber+1;s++){
        int p1=shop[s].indexOf(">");
        shop[s]=shop[s].substring(p1+1,shop[s].length());  
        v[s]=v[s].replace(" ", "");
        }
 
 
        writefile("datax.csv");
 
 
    }
 
 
    void writefile(String file){ 
 
try{ 
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file))); 
 
int s,sx;
for(s=1;s<datanumber+1;s++){    
pw.print(year[s]); 
pw.print(",");    
pw.print(month[s]); 
pw.print(","); 
pw.print(shop[s]); 
pw.print(","); 
pw.print(credit[s]); 
pw.print(","); 
pw.println(v[s]);  
} 
 
 
System.out.println("ファイルに書きこみました。"); 
pw.close(); 
} catch(IOException ep){ System.out.println("入出力エラーです。"); } 
 
 
} 
 
 
 
 
 
}
 
最終更新:2016年04月09日 04:10