定位单词位置

来源:互联网 发布:nero刻录软件怎样下载 编辑:程序博客网 时间:2024/05/22 00:37

文件1中形式:

          T1 Protein 401 420 bcr-abl fusion gene
          T2 Protein 480 496 interferon alpha
          T3 Protein 498 507 IFN-alpha
          T4 Protein 683 713 interferon regulatory factor 4
          T5 Protein 715 720 IRF-4

文件2:就是普通的 txt 文本,


问题:文件1已经给出了字符串及其开始字符和结束字符的位置,在文件2中找出来:

  

                          for(int i = 0; i < fi.length; i++){                name = fi[i].getName();        m = name.lastIndexOf(".");                if(name.substring(m + 1).equals("a1")){                fileR = new FileReader("E:\\test\\" + name);        buffR = new BufferedReader(fileR);                fileW = new FileWriter("E:\\tessm\\" + name);        buffW = new BufferedWriter(fileW);                char c[] = mp.paraprint();        List mylist = mp.char_list(c);                String temp;        int y = 0;        while((temp = buffR.readLine()) != null){ //读的是 a1 文件        String str[] = temp.split(" ");        int a = (Integer) Integer.parseInt(str[2]);        int b = (Integer) Integer.parseInt(str[3]);                    //int num =(b-a);            //String text = "";                    for(int x = 0; x < mylist.size(); x++){        if(x == a){               for(int j = 0; j < num; j++){           text = text + mylist.get(x+j);                   }        buffW.write("[" + text + "]");        buffW.newLine();        buffW.flush();*/        }        }                        //System.out.println("[" + text + "]");        }                mp.list_string(mylist);            }        }



0 0
原创粉丝点击