package power;
import java.io.*;
public class pro {
int s,datanumber;
String[] data=new String[6000];
String[] city=new String[6000];
String[] pref=new String[6000];
String[] town=new String[6000];
String[] code_city=new String[6000];
String[] code_pref=new String[6000];
String[] code_town=new String[6000];
String[] lon=new String[6000];
String[] lat=new String[6000];
public static void main(String[] args) {
pro t=new pro();
}
pro(){
readx("22_2014.csv");
for(s=2;s<datanumber+1;s++){
data[s]=data[s].replace("\"","");
String[] x=data[s].split(",");
pref[s-1]=x[1];
city[s-1]=x[3];
town[s-1]=x[5];
code_pref[s-1]=x[0];
code_city[s-1]=x[2];
code_town[s-1]=x[4];
lon[s-1]=x[6];
lat[s-1]=x[7];
}
datanumber=datanumber-1;
for(s=1;s<datanumber+1;s++){
data[s]=code_pref[s]+","+code_city[s]+","+code_town[s]+","+pref[s]+","+city[s]+","+town[s]+","+lon[s]+","+lat[s];
}
writexml("ren.txt");
}
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(data[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),"SJIS"));
while((str = br.readLine()) != null) {
s=s+1;
data[s]=str;
}
br.close();
} catch (IOException e) {System.out.println(e);}
datanumber=s;
}
}
最終更新:2016年02月04日 17:14