package monet;
import tool.*;
import java.io.*;
public class pro {
int number;
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];
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(",");
String[] z=y[0].split("/");
year[s]=Integer.parseInt(z[0]);
month[s]=Integer.parseInt("7"+z[1])-700;
for(sx=1;sx<y.length;sx++){
v[s][sx]=y[sx];
}}
int tr;
writefile("ren.txt");
}
void writefile(String file){
try{
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file)));
int sx;
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((str = br.readLine()) != null) {
s=s+1;
data[s]=str;
}
br.close();
} catch (IOException e) {System.out.println(e);}
datanumber=s;
}
}
最終更新:2015年08月28日 20:00