package com.whatratimes.util;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
/*
-----------程序说明-------------
程序名称:JAVA写的JUBB
程序作者:Redhat
发布时间:2003.5.23
主页:http://2002.buyionline.net
授权:免费、自由传播及自由修改但请保留原作者信息
版本:1.0
使用的时候最好转换成JAVABEAN,加入你和JAVA LIB中去.
*/
public class JUBB
{
public static JUBB jubb = new JUBB();
public static String getHTML(String ubb, int question_id)
{
return jubb.getAll(ubb, question_id);
}
public static String getNoTag(String ubb )
{
String s = ubb;
s = jubb.replace(s, "&", "&");
s = jubb.replace(s, "\"", """);
s = jubb.replace(s, "<", "<");
s = jubb.replace(s, ">", ">");
return s;
}
public static String getBrText(String ubb)
{
String s = ubb;
s = jubb.replace(s, "&", "&");
s = jubb.replace(s, "\"", """);
s = jubb.replace(s, "<", "<");
s = jubb.replace(s, ">", ">");
return jubb.ReBr(s);
}
String u_s = new String("haha");
String u_s1 = new String("haha");
Pattern u_p;
Matcher u_m;
CharSequence u_s2;
boolean result;
/** 得到转换后的所有JUBB代码 */
public String getAll(String ins, int question_id)
{
String s = ins;
s = this.replace(s, "&", "&");
s = this.replace(s, "\"", """);
s = this.replace(s, "<", "<");
s = this.replace(s, ">", ">");
s = this.ReColor(s);
s = this.ReImg(s, question_id);
s = this.ReUrl(s);
// s = this.ReFly(s);
s = this.ReEmail(s);
s = this.ReBold(s);
// s = this.ReSlope(s);
// s = this.ReDownLine(s);
// s = this.ReMove(s);
s = this.ReTxtUrl(s);
s = this.ReTxtEmail(s);
s = this.ReTxtSize(s);
// s = this.ReQuote(s);
// s = this.ReCode(s);
// s = this.ReSup(s);
// s = this.ReSub(s);
// s = this.ReDelLine(s);
// s = this.ReFliph(s);
// s = this.ReFlipv(s);
// s = this.ReShadow(s);
// s = this.ReGlow(s);
// s = this.ReBlur(s);
// s = this.ReSwf(s);
// s = this.ReRm(s);
// s = this.ReMp(s);
// s = this.ReSk(s);
// s = this.ReSound(s);
// s = this.ReInvert(s);
// s = this.ReXray(s);
// s = this.ReLi(s);
// s = this.ReLi1(s);
// s = this.ReLi2(s);
s = this.ReBr(s);
s = this.ReAlign(s);
// s = this.ReQt(s);
s = this.ReFace(s);
s = this.ReSpace(s);
return s;
}
/** 每个替换都需要用到的公共函数 */
public String replace(String strSource, String strFrom, String strTo)
{
String strDest = "";
int intFromLen = strFrom.length();
int intPos;
while ((intPos = strSource.indexOf(strFrom)) != -1)
{
strDest = strDest + strSource.substring(0, intPos);
strDest = strDest + strTo;
strSource = strSource.substring(intPos + intFromLen);
}
strDest = strDest + strSource;
return strDest;
}
//
// <font color="#FF0000">hhhhhh</font>
/** 转换URL([url=http://www.sina.com.cn]新浪[/url]) */
/** Color替换([color=#dbff00]aaaa[/color]) */
public String ReColor(String ins)
{
this.u_s1 = ins;
this.u_s = ins;
this.u_s2 = this.u_s1.subSequence(0, this.u_s1.length());
try
{
this.u_p = Pattern.compile("(\\[color=)([^\\]]+)(\\])(.+?)(\\[\\/color\\])", Pattern.CASE_INSENSITIVE);
this.u_m = this.u_p.matcher(this.u_s2);
this.result = this.u_m.find();
while (result)
{
this.u_s = this.replace(this.u_s1, this.u_m.group(1) + this.u_m.group(2) + this.u_m.group(3) + this.u_m.group(4) + this.u_m.group(5), "<font color='" + this.u_m.group(2) + "'>" + this.u_m.group(4) + "</font>");
this.u_s1 = this.u_s;
this.u_m.find();
}
} catch (Exception e)
{
}
return u_s;
}
/** IMG替换([img]http://domain.com/path/img.jpg[/img]) */
public String ReImg(String ins, int question_id)
{
this.u_s1 = ins;
this.u_s = ins;
this.u_s2 = this.u_s1.subSequence(0, this.u_s1.length());
try
{
this.u_p = Pattern.compile("(\\[img\\])(.+?)(\\[\\/img\\])", Pattern.CASE_INSENSITIVE);
this.u_m = this.u_p.matcher(this.u_s2);
this.result = this.u_m.find();
while (result)
{
this.u_s = this.replace(this.u_s1, this.u_m.group(1) + this.u_m.group(2) + this.u_m.group(3), "<img src=../CourseQuestion/"+ question_id +"/" + this.u_m.group(2) + " border=0>");
this.u_s1 = this.u_s;
this.u_m.find();
}
} catch (Exception e)
{
}
return u_s;
}
/** 图片底片效果([invert]img.jpg[/invert]) */
public String ReInvert(String ins)
{
this.u_s1 = ins;
this.u_s = ins;
this.u_s2 = this.u_s1.subSequence(0, this.u_s1.length());
try
{
this.u_p = Pattern.compile("(\\[invert\\])(.+?)(\\[\\/invert\\])", Pattern.CASE_INSENSITIVE);
this.u_m = this.u_p.matcher(this.u_s2);
this.result = this.u_m.find();
while (result)
{
this.u_s = this.replace(this.u_s1, this.u_m.group(1) + this.u_m.group(2) + this.u_m.group(3), "<table style=\"filter:invert\"><img src=" + this.u_m.group(2) + " border=0></table>");
this.u_s1 = this.u_s;
this.u_m.find();
}
} catch (Exception e)
{
}
return u_s;
}
/** 图片曝光效果([xray]img.jpg[/xray]) */
public String ReXray(String ins)
{
this.u_s1 = ins;
this.u_s = ins;
this.u_s2 = this.u_s1.subSequence(0, this.u_s1.length());
try
{
this.u_p = Pattern.compile("(\\[xray\\])(.+?)(\\[\\/xray\\])", Pattern.CASE_INSENSITIVE);
this.u_m = this.u_p.matcher(this.u_s2);
this.result = this.u_m.find();
while (result)
{
this.u_s = this.replace(this.u_s1, this.u_m.group(1) + this.u_m.group(2) + this.u_m.group(3), "<table style=\"filter:xray\"><img src=" + this.u_m.group(2) + " border=0></table>");
this.u_s1 = this.u_s;
this.u_m.find();
}
} catch (Exception e)
{
}
return u_s;
}
/** 转换URL([url]http://somedomain[/url]) */
public String ReUrl(String ins)
{
this.u_s1 = ins;
this.u_s = ins;
this.u_s2 = this.u_s1.subSequence(0, this.u_s1.length());
try
{
this.u_p = Pattern.compile("(\\[url\\])(.+?)(\\[\\/url\\])", Pattern.CASE_INSENSITIVE);
this.u_m = this.u_p.matcher(this.u_s2);
this.result = this.u_m.find();
while (result)
{
this.u_s = this.replace(this.u_s1, this.u_m.group(1) + this.u_m.group(2) + this.u_m.group(3), "<a href=" + this.u_m.group(2) + " target=_blank>" + this.u_m.group(2) + "</a>");
this.u_s1 = this.u_s;
this.u_m.find();
}
} catch (Exception e)
{
}
return u_s;
}
/** 转换URL([url=http://www.sina.com.cn]新浪[/url]) */
public String ReTxtUrl(String ins)
{
this.u_s1 = ins;
this.u_s = ins;
this.u_s2 = this.u_s1.subSequence(0, this.u_s1.length());
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![py](https://img-home.csdnimg.cn/images/20210720083646.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 541 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/f62fbb2c17a9404795551a60e3b1502a_weixin_32393347.jpg!1)
小码蚁.
- 粉丝: 2664
- 资源: 4483
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
- 编程项目实战:基于ASP.NET架构的学生信息管理系统(含源代码+毕设文档)
- 毕设项目:学生信息管理系统(asp.net+源代码+文档)
- 腾讯研究院2024向AI而行共筑新质生产力-行业大模型调研报告
- 197a1ac6-f7cf-40a4-9ceb-422fa907ca05 (1).html
- java学习从入门到精通,全面了解面向对象开发
- 【抓取磁力链】DHTCrawler.zip
- 爱普生打印机废墨仓清零软件永久版和教程
- 数据库管理工具:dbeaver-ce-23.0.1-amd64.deb
- html贾程鑫10.zip
- 数据库管理工具:dbeaver-ce-24.1.0-x86-64-setup.exe
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)