/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com;
import java.io.*;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
public class pro {
String[] data=new String[90000];
int s,datanumber;
String[] v1=new String[90000];
String[] v2=new String[90000];
String[] v3=new String[90000];
String[] m1=new String[90000];
String[] m2=new String[90000];
String[] m3=new String[90000];
String[] geo=new String[90000];
String[] city=new String[90000];
public static void main(String[] args) {
pro te=new pro();
}
pro(){
readx("data.csv");
for(s=1;s<datanumber+1;s++){
String[] x=data[s].split(",");
geo[s]=x[4]+x[5]+x[6];
city[s]=x[9]+x[10];
v1[s]=x[21];
v2[s]=x[22];
v3[s]=x[23];
m1[s]=x[24];
m2[s]=x[25];
m3[s]=x[26];
}
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.print(geo[s]);
pw.print(",");
pw.print(city[s]);
pw.print(",");
pw.print(v1[s]);
pw.print(",");
pw.print(v2[s]);
pw.print(",");
pw.print(v3[s]);
pw.print(",");
pw.print(m1[s]);
pw.print(",");
pw.print(m2[s]);
pw.print(",");
pw.println(m3[s]);
}
System.out.println("ファイルに書きこみました。");
pw.close();
} catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
void readx(String file){
String str;
BufferedReader br;
int s;
s=0;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8"));
while((str = br.readLine()) != null) {
s=s+1;
data[s]=str;
}
br.close();
} catch (IOException e) {System.out.println(e);}
datanumber=s;
}
}
最終更新:2017年03月07日 05:39