打印本文 打印本文 关闭窗口 关闭窗口
java连接oracle,取io文件内容,子串替换(原作)!
作者:武汉SEO闵涛  文章来源:敏韬网  点击数2699  更新时间:2009/4/22 22:05:06  文章录入:mintao  责任编辑:mintao
p;               e.printStackTrace();
                        }
                        return rtncd;
                }
        public void close(){
                try{
                        if(stmt!=null)stmt.close();
                        if(conn!=null)conn.close();
                }
                catch(SQLException e){
                        e.printStackTrace();
                }
        }
        public String replaSbstr(String strSource,String strFrom,String strTo){
                if (strSource == null) {
                                                                 return null;    }
                int i = 0;
                if ((i = strSource.indexOf(strFrom, i)) >= 0) {
                                                          char[] cSrc = strSource.toCharArray();
                                                          char[] cTo = strTo.toCharArray();
                                                          int len = strFrom.length();
                                                          StringBuffer buf = new StringBuffer(cSrc.length);
                                                          buf.append(cSrc,0,i);
                                                          buf.append(cTo);
                                                          //buf.append(cSrc, 0, i).append(cTo);
                                                          i += len;
                                                          int j = i;
                                                          while ((i = strSource.indexOf(strFrom, i)) > 0) {
                                                                                buf.append(cSrc,j,i-j);
                                                                                buf.append(cTo);
                                                                                          //buf.append(cSrc, j, i - j).append(cTo);
                                                                                          i += len;
                                                                                          j = i;
                                                                                                         }
                                                          buf.append(cSrc, j, cSrc.length - j);
                   

上一页  [1] [2] [3] [4]  下一页

打印本文 打印本文 关闭窗口 关闭窗口