package neko5;
import tool.*;
public class pro {
int s,datanumber;
String[] data=new String[5000];
String[] sta=new String[5000];
String[] hour=new String[5000];
int tx;
String[] subdata=new String[5000];
String[] subx=new String[5000];
public static void main(String[] args) {
pro t=new pro();
}
pro(){
int tr;
for(tr=1;tr<337;tr++){
readfile sub2=new readfile();
sub2.makedata("gdata/"+tr+".txt","UTF-8");
data=sub2.data;
datanumber=sub2.datanumber;
System.out.println(tr);
int sx;
tx=0;
for(s=1;s<datanumber+1;s++){
catchword sub=new catchword();
sta[s]=sub.makedata(data[s],"sta");
hour[s]=sub.makedata(data[s],"time");
String str=sub.makedata(data[s],"tv");
str=str.replace("△△", "△");
str=change(str);
str=str.trim();
String[] x=str.split("△");
for(sx=0;sx<x.length;sx++){
x[sx]=x[sx].trim();
x[sx]=x[sx].replace(" ", "△");
if(x[sx].indexOf("(")>-1)x[sx]="";
if(x[sx].length()>0)tx=tx+1;
if(x[sx].length()>0)subdata[tx]=sta[s]+"△"+hour[s]+"△"+x[sx];
}
}
datanumber=tx;
for(s=1;s<datanumber+1;s++){
String[] x1=subdata[s].split("△");
String[] y=x1[2].split(":");
if(x1[2].indexOf(":")>-1)x1[1]=y[0];
if(x1[2].indexOf(":")>-1)x1[2]=y[1];
subx[s]="";
if(x1.length>3)x1[3]=x1[3].replace(",","");
if(x1.length>3)subx[s]=x1[0]+","+x1[1]+","+numx(x1[2])+","+x1[3];
}
writefile sub5=new writefile();
sub5.data=subx;
sub5.datanumber=datanumber;
sub5.makedata("data/"+tr+".txt");
}
}
String change(String str){
int n;
for(n=1;n<11;n++){
str=rev(str);
}
return str;
}
String rev(String str){
if(str==null)str="";
int p1=str.indexOf("<");
int p2=str.indexOf(">",p1);
String strx="";
if(p2>-1)strx=str.substring(p1,p2+1);
str=str.replace(strx,"");
return str;
}
int numx(String str){
int nx;
nx=0;
try{
nx=Integer.parseInt(str);
}catch (Exception e) {}
return nx;
}
}
最終更新:2016年08月28日 22:37