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());
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
Java是一种面向对象的编程语言,它具有安全、可靠、简单、高效、跨平台等特点,被广泛应用于各种类型的应用程序开发。Java程序由Java源代码编写,经过编译后生成Java字节码文件,然后在Java虚拟机上运行。 Java程序通常包括一个或多个类,每个类都包含了属性和方法。Java程序的入口点是一个特殊的类,它包含了一个名为main的方法,这个方法是程序的起点。Java程序可以使用各种开发工具进行编写、编译和调试,比如IntelliJ IDEA等。 Java程序可以用于开发各种类型的应用程序,包括桌面应用程序、Web应用程序、移动应用程序等。Java的跨平台特性使得Java程序可以在任何支持Java虚拟机的操作系统上运行,包括Windows、Linux、Mac OS等。这使得Java程序的开发和部署变得更加灵活和方便。 Java程序的编写需要遵循面向对象的编程思想,即将程序看作一组对象的集合,每个对象具有自己的属性和方法。Java程序中的对象可以通过类进行定义和创建,类是一种抽象的概念,它描述了一类具有相同属性和方法的对象。 更多项目内容可以直接下载查看,内容有完整项目源码。
资源推荐
资源详情
资源评论
收起资源包目录
基于java实现作业管理系统设计附项目源码+文档说明 (541个子文件)
JUBB.class 20KB
StudyHelper.class 12KB
GradePaperHelper.class 11KB
SetExamHelper.class 10KB
AttributeHelper.class 10KB
SQLExecuter.class 10KB
MessageHelper.class 9KB
ConstHelper.class 8KB
StudentsHelper.class 7KB
BBSHelper.class 7KB
MessageCreateAction.class 7KB
DBHelper.class 6KB
LoginAction.class 5KB
StartExamAction.class 5KB
AssignExamUpdateAction.class 5KB
PaperHelper.class 4KB
SubmitAnswerAction.class 4KB
PracticeUploadAction.class 4KB
SubmitChoicesPaperAction.class 4KB
SubmitPracticeAction.class 4KB
CourseQuestionServlet.class 4KB
BeanHelper.class 3KB
QuerySQLExecuter.class 3KB
LogonAction.class 3KB
TeacherDetailAction.class 3KB
DBOperation.class 3KB
ModifyExamAction.class 3KB
TopicListAction.class 3KB
GradeQuestionAction.class 3KB
AnnounceListAction.class 3KB
StudyTableAction.class 3KB
AnnounceUpdateAction.class 3KB
LoginFilter.class 3KB
SearchPapersAction.class 3KB
ChangeExamAction.class 3KB
StudentFileServlet.class 2KB
SessionTracker.class 2KB
UpdateSQLExecuter.class 2KB
EnterExamAction.class 2KB
GradeByQuestionAction.class 2KB
ExamFileDeleteAction.class 2KB
CloseAssignmentAction.class 2KB
SubmitGradeQuestionAction.class 2KB
GradePaperAction.class 2KB
QuestionResultAction.class 2KB
ContinueExamAction.class 2KB
InsertSQLExecuter.class 2KB
LogoutAction.class 2KB
SubmitPaperAction.class 2KB
PaperResultChoicesAction.class 2KB
StudentsAction.class 2KB
ChangeClassAction.class 2KB
AssignExamAction.class 2KB
EnterAnswerPaperAction.class 2KB
SetCharacterEncodingFilter.class 2KB
PaperResultAction.class 2KB
ChangeCourseAction.class 2KB
EnterPracticePaperAction.class 2KB
HandOutAction.class 2KB
AssignedExamListAction.class 2KB
MessageDeleteAction.class 2KB
StudentStudyInfoAction.class 2KB
AnnounceDeleteAction.class 2KB
PaperResultOtherTypesAction.class 2KB
MessageViewAction.class 2KB
SessionControl.class 2KB
BoardListAction.class 2KB
MessageUpdateAction.class 2KB
UserSQLExecuter.class 1KB
TeacherDetailUpdateAction.class 1KB
DeleteSQLExecuter.class 1KB
CourseListAction.class 1KB
MessageListAction.class 1KB
EnterChoicesPaperAction.class 1KB
StudentDetailAction.class 1KB
t_student.class 929B
DisplayHelper.class 868B
t_school.class 832B
t_new_student.class 791B
t_user.class 761B
CompareMessage.class 752B
t_question.class 699B
t_bbs_announce.class 583B
t_exam.class 581B
t_teacher.class 580B
t_exam_submit.class 566B
t_teacher_log.class 548B
t_teacher_training.class 539B
t_exam_question_upload.class 522B
t_messages.class 515B
t_course_history.class 500B
t_teacher_exam.class 487B
t_course.class 486B
t_teacher_evaluation.class 482B
t_exam_question_submit.class 480B
t_question_file.class 479B
t_class_course.class 472B
t_exam_assigned.class 472B
t_class.class 467B
t_teacher_award.class 456B
共 541 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
静香是个程序媛
- 粉丝: 3853
- 资源: 563
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功