アットウィキロゴ

hobok

package info2;
 
import java.io.File;
import tool.*;
 
 
public class pro {
 
     int s,datanumber;
    String[] data=new String[5000];
 
   String[] name=new String[50000];
     String[] credit=new String[50000];
        String[] v=new String[50000];
 
        String[] sta=new String[50000];
        String[] term=new String[5000];
        String[] time=new String[5000];
 
        String[] t1=new String[5000];
        String[] t2=new String[5000];
        int[] y1=new int[6000];
        int[] y2=new int[6000];
        int[] m1=new int[6000];
        int[] m2=new int[6000];
 
        String[] week=new String[5000];
 
    public static void main(String[] args) {
        pro te=new pro();
    }
    pro(){
 
 
   readfile sub4=new readfile();
   sub4.makedata("p2.csv","UTF-8");
   data=sub4.data;
   datanumber=sub4.datanumber;  
 
 
 
 
for(s=1;s<datanumber+1;s++){
String[] x=data[s].split(",");
name[s]=x[0];
sta[s]=x[1];
term[s]=x[2];
time[s]=x[3];
if(time[s].equals("null"))time[s]="";
if(time[s]==null)time[s]="";
}
 
for(s=1;s<datanumber+1;s++){
term[s]=term[s].replace("~", "-");
term[s]=term[s].replace("‐", "-");
term[s]=term[s].replace("?", "-");
if(term[s].indexOf("-")<1)term[s]="";
}
 
for(s=1;s<datanumber+1;s++){
String[] x=term[s].split("-");
t1[s]="";
t2[s]="";
if(x.length>0)t1[s]=x[0];
if(x.length>1)t2[s]=x[1];
}
 
 
for(s=1;s<datanumber+1;s++){
int p1=t1[s].indexOf("年");
int p2=t1[s].indexOf("月");
String yy="";
if(p1>-1)yy=t1[s].substring(0,p1);
String mm="";
y1[s]=numx(yy);
if(p2>-1)mm=t1[s].substring(p1+1,p2);
m1[s]=numx(mm);
}
 
 
for(s=1;s<datanumber+1;s++){
t2[s]=t2[s].trim();
t2[s]=t2[s].replace(" ","");
 
 
    int p1=t2[s].indexOf("年");
int p2=t2[s].indexOf("月",p1);
String yy="";
if(p1>-1)yy=t2[s].substring(0,p1);
String mm="";
y2[s]=numx(yy);
if(p2>-1)mm=t2[s].substring(p1+1,p2);
m2[s]=numx(mm);
}
 
    for(s=1;s<datanumber+1;s++){
int h=0;
if(m2[s]>0)h=h+1;
if(y2[s]==0)h=h+1;
if(h==2)y2[s]=y1[s];
}
 
     for(s=1;s<datanumber+1;s++){
time[s]=time[s].replace("曜日","曜");
time[s]=time[s].replace("毎週","");
time[s]=time[s].replace("平日","");
time[s]=time[s].replace("~","-");
time[s]=time[s].replace("】","");
 
if(time[s].indexOf("同上")>-1)time[s]=time[s-1];
int p3=time[s].indexOf("曜");
int p4=-1;
if(p3>-1)p4=time[s].indexOf("曜",p3+1);
if(p4>-1)p3=p4;
week[s]="";
if(p3>-1)week[s]=time[s].substring(0,p3+1);
time[s]=time[s].replace(week[s],"");
time[s]=time[s].trim();
int p5=time[s].indexOf("(");
if(p5>-1)time[s]=time[s].substring(0,p5);
p5=time[s].indexOf("[");
if(p5>-1)time[s]=time[s].substring(0,p5);
p5=time[s].indexOf("→");
if(p5>-1)time[s]=time[s].substring(0,p5);
p5=time[s].indexOf("(");
if(p5>-1)time[s]=time[s].substring(0,p5);
String[] x=time[s].split("-"); 
x[0]=x[0].replace("時",":");
x[0]=x[0].replace("分",":");
t1[s]="";
t2[s]="";
if(x.length==2)t1[s]=x[0];
if(x.length==2)t2[s]=x[1];
 } 
 
  for(s=1;s<datanumber+1;s++){   
  System.out.println(name[s]+","+sta[s]+","+week[s]+","+y1[s]+","+m1[s]+","+y2[s]+","+m2[s]+","+t1[s]+","+t2[s]);
  }
 
 
 
    }
 
 
        int numx(String str){
 
    int nx;
 
    nx=0;
 
 try{
 
    nx=Integer.parseInt(str);
 
 }catch (Exception e) {}
 
 return nx;
 
 
 
} 
 
 
    }
 
最終更新:2016年09月05日 03:03