アットウィキロゴ

p082213

package monet;

import tool.*;
import java.io.*;


public class pro {

   int s,datanumber;
   String[] [[data]]=new String[500000];
    String[] [[name]]=new String[5000];
    int[] code=new int[50000];
    String[] credit=new String[50000];
    int[] month=new int[50000];
    int[] year=new int[50000];
    String[][] v=new String[5000][500];
    
      int number;
    
   public static void main(String[] args) {
       pro test=new pro();
   }
   
   pro(){

         String file,str;
       
         file="data.csv";
          
         readx(file);
       
          double d;
          int y1,m1;
          String c;
         
          String[] cr=data[2].split(",");
          
        
          
          number=cr.length-1;
          [[for]](s=1;s<number+1;s++){
          credit[s]=cr[s];    
          }
          
          int sx;
          
        for(s=3;s<datanumber+1;s++){
     String[] y=data[s].split(",");
     for(sx=1;sx<y.length;sx++){
     v[s][sx]=y[sx];
     v[s][sx]=v[s][sx].replace(" ","");
     
     }
         System.out.println(data[s]); 
        }
     
        
        y1=1999;
        m1=4;
        
     for(s=3;s<datanumber+1;s++){
     m1=m1+1;
     if(m1>4)y1=y1+1;
     if(m1>4)m1=1;
     year[s]=y1;    
     month[s]=m1;
     }
        
 
 
   writexml("[[ren]].txt");
        
        
        
          
          
          
   
   }
    void writexml(String file){ 

   int s,sx;
   
try{
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file)));

for(s=3;s<datanumber+1;s++){
for(sx=1;sx<number+1;sx++){
pw.print("<year>");
pw.print(year[s]);
pw.print("</year>");
pw.print("<month>");
pw.print(month[s]);
pw.print("</month>");
pw.print("<credit>");
pw.print(credit[sx]);
pw.print("</credit>");
pw.print("<value>");
pw.print(v[s][sx]);
pw.println("</value>");
}
}


System.out.println("ファイルに書きこみました。");
pw.close();
} catch(IOException ep){ System.out.println("入出力エラーです。"); }


}




  int numx(String str){
   int nx;
   nx=0;
try{
   nx=Integer.parseInt(str);
}catch (Exception e) {}
return nx;

}


double num(String str){
   double nx;
   nx=0;
try{
   nx=Double.parseDouble(str);
}catch (Exception e) {}
return nx;

}


void readx(String file){

String str;
BufferedReader br;
int s;
s=0;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file),"SJIS"));
while*1 != null) {
s=s+1;
data[s]=str;
}
br.close();
} catch (IOException e) {System.out.println(e);}

datanumber=s;

}



}
最終更新:2015年08月22日 15:28

*1 str = br.readLine(