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的作业管理系统.zip (540个子文件)
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
共 540 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
大雨淅淅
- 粉丝: 5074
- 资源: 347
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功