快精灵印艺坊 您身边的文印专家
广州名片 深圳名片 会员卡 贵宾卡 印刷 设计教程
产品展示 在线订购 会员中心 产品模板 设计指南 在线编辑
 首页 名片设计   CorelDRAW   Illustrator   AuotoCAD   Painter   其他软件   Photoshop   Fireworks   Flash  

 » 彩色名片
 » PVC卡
 » 彩色磁性卡
 » 彩页/画册
 » 个性印务
 » 彩色不干胶
 » 明信片
   » 明信片
   » 彩色书签
   » 门挂
 » 其他产品与服务
   » 创业锦囊
   » 办公用品
     » 信封、信纸
     » 便签纸、斜面纸砖
     » 无碳复印纸
   » 海报
   » 大篇幅印刷
     » KT板
     » 海报
     » 横幅

About UBB with java has a bug.

// the bug has been fixed
/*+-------------------------------
    $REReplace.java 2001-9-4
    $author pizer.chen
    $history:
        0.2 fixed a bug.
        0.1 ...
+-------------------------------*/
package com.wacos.util.ubb;

import java.io.*;
import java.util.*;
import org.apache.regexp.*;
/**
*
* @author  Pizer.chen -- iceant -- 陈鹏
* @version 0.2
*/
public class REReplace
{
    /**
     * replace the inStr with pattern1 & pattern2
    **/
    public static String replace(String pattern1,String pattern2,String inStr){
        try {
            RE re = new RE(pattern1);
            RE re2 = new RE("//$([0-9])");
            String tempPat2=pattern2;
            int point=0;
            while(re.match(inStr)){
                while(re2.match(pattern2)){
                    point = Integer.parseInt(re2.getParen(1));
                    pattern2=re2.subst(pattern2,re.getParen(point),RE.REPLACE_FIRSTONLY);
                }
                inStr = re.subst(inStr,pattern2,RE.REPLACE_FIRSTONLY);
                pattern2 = tempPat2;
            }
            return inStr;
        }
        catch (Exception e) {
            System.out.println(e);
            return e.toString();
        }  
    }
}    



返回类别: 教程
上一教程: 关于JDBC
下一教程: 生产者消费者模型的Java简朴实现

您可以阅读与"About UBB with java has a bug."相关的教程:
· JAVA写的简朴UBB类
· JAVA中对HASHMAP的深度分析与比较
· bug? Hbm2JavaTask无法实现joined-subclass单独配置文件(2.1.2)
· Java中对HashMap的深度分析
· A simple example about full-text search based Java:Lucene
    微笑服务 优质保证 索取样品