这部分代码什么意思,除了HTML生成器还有什么?

simple0418 2008-04-19 10:12:38


package yy;
import java.io.*;
import java.util.*;
public class bbcode{
public String HTMLEncode(String Str){
Str=YYReplace(Str,"<",">");
Str=YYReplace(Str,">","<");
Str=YYReplace(Str,"\n","<BR>");
return Str;
}
public String YYReplace(String Str,String oldStr,String newStr){
String ReturnStr="";
int i,j,t,m,n;
n=0;
j=oldStr.length();
if (Str.indexOf(oldStr)>-1)
{
while(Str.indexOf(oldStr,n)>-1)
{
i=Str.length();
if (Str.indexOf(oldStr)==0)
Str=newStr+Str.substring(j,i);
else
{
t=Str.indexOf(oldStr);
m=(t+j);
Str=Str.substring(0,t)+newStr+Str.substring(m,i);
n=t+newStr.length()-j+1;
}
}
}
ReturnStr=Str;
return ReturnStr;

}
public String LCReplace(String Str,String BStr,String EStr,String ReStr){
String ReturnStr="",Str1="",Str2="";
int i,j,n;
n=0;
if ((Str.indexOf(BStr)>-1)&&((Str.indexOf(EStr)>-1)))
{
while(Str.indexOf(BStr,n)>-1)
{
i=Str.indexOf(BStr);
j=Str.indexOf(EStr);
Str1=Str.substring((i+BStr.length()),j);
Str2=YYReplace(ReStr,"$jjtt$",Str1);
Str1=BStr+Str1+EStr;
Str=YYReplace(Str,Str1,Str2);
n=i+Str2.length()-Str1.length();
}
}
ReturnStr=Str;
return ReturnStr;
}
public String yyBBCODE(String Str){
String BStr,EStr,ReStr;
BStr="";
EStr="
";
ReStr="<b>$jjtt$</b>";
Str=LCReplace(Str,BStr,EStr,ReStr);

BStr="";
EStr="
";
ReStr="<i>$jjtt$</i>";
Str=LCReplace(Str,BStr,EStr,ReStr);

BStr="";
EStr="
";
ReStr="<u>$jjtt$</u>";
Str=LCReplace(Str,BStr,EStr,ReStr);

BStr=" EStr="">";
EStr="";
ReStr="<img align=absmiddle src=IMAGES/EMAIL1.GIF><A HREF='mailto:$jjtt$' >$jjtt$</A>";
Str=LCReplace(Str,BStr,EStr,ReStr);

BStr="
引用
";
EStr="
";
ReStr="<br>引用<hr noshade size=1 color=#C0C0C0>$jjtt$<br><hr noshade size=1 color=#C0C0C0><br>";
Str=LCReplace(Str,BStr,EStr,ReStr);

BStr=" EStr="" target="_blank">";
EStr="
";
ReStr="<A HREF=http://$jjtt$ TARGET=_blank>$jjtt$</A>";
Str=LCReplace(Str,BStr,EStr,ReStr);

BStr="[img]";
EStr="[/img]";
ReStr="<a href='$jjtt$' target=_blank><IMG SRC=$jjtt$ border=0 alt=按此在新窗口浏览图片 onload='javascript:if(this.width>screen.width-333)this.width=screen.width-333'></a>";
Str=LCReplace(Str,BStr,EStr,ReStr);

BStr="[flash]";
EStr="[/flash]";
ReStr="<OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 width=500 height=400><PARAM NAME=movie VALUE=''$jjtt$''><PARAM NAME=quality VALUE=high><embed src=''$jjtt$'' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' >$jjtt$</embed></OBJECT>";
Str=LCReplace(Str,BStr,EStr,ReStr);

BStr=":)";
EStr="<img src=IMAGES/SMILE.GIF border=0>";
Str=YYReplace(Str,BStr,EStr);

BStr=":(";
EStr="<img src=IMAGES/SAD.GIF border=0>";
Str=YYReplace(Str,BStr,EStr);

BStr=":D";
EStr="<img src=IMAGES/BIGSMILE.GIF border=0>";
Str=YYReplace(Str,BStr,EStr);

BStr=";)";
EStr="<img src=IMAGES/WINK.GIF border=0>";
Str=YYReplace(Str,BStr,EStr);

BStr=":cool:";
EStr="<img src=IMAGES/COOL.GIF border=0>";
Str=YYReplace(Str,BStr,EStr);

BStr=":mad:";
EStr="<img src=IMAGES/MAD.GIF border=0>";
Str=YYReplace(Str,BStr,EStr);

BStr=":o";
EStr="<img src=IMAGES/SHOCKED.GIF border=0>";
Str=YYReplace(Str,BStr,EStr);

BStr=":P";
EStr="<img src=IMAGES/TONGUE.GIF border=0>";
Str=YYReplace(Str,BStr,EStr);
return Str;
}
}
...全文
50 点赞 收藏 1
写回复
1 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
Atai-Lu 2008-04-20
替换ubb标签为相应的html标签
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2008-04-19 10:12
社区公告
暂无公告