一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

ubb 转换成html代码

时间:2008-04-29 编辑:简简单单 来源:一聚教程网

<%
function unhtml(s_string)
 s_string=replace(s_string,"&","&")
 's_string=replace(s_string," "," ")
 s_string=replace(s_string,"<","<")
 unhtml=replace(s_string,">",">")
end function
function ubbimg(s_string)
 s_string=replace(s_string,"[img]","")
end function
function ubb_url(s_string)
 str_len=len(s_string)
 start_pos=instr(s_string,"[url]")
 if start_pos>0 then
  end_pos=instr(start_pos,s_string,"[/url]")
  if end_pos>0 then
   url=mid(s_string,start_pos+5,end_pos-start_pos-5)
   s_string=left(s_string,start_pos-1)&""&url&""&right(s_string,str_len-end_pos-5)
   call ubb_url(s_string)
  end if
 end if
 ubb_url=s_string
end function
function ubburl(s_string)
 s_string=ubb_url(s_string)
 str_len=len(s_string)
 start_pos=instr(s_string,"[url=")
 if start_pos>0 then
  end_pos=instr(start_pos,s_string,"]")
  end_pos2=instr(start_pos,s_string,"[/url]")
  if end_pos>0 and end_pos2>end_pos then
   url=mid(s_string,start_pos+5,end_pos-start_pos-5)
   s_string=left(s_string,start_pos-1)&""&right(s_string,str_len-end_pos)
   call ubburl(s_string)
  end if
 end if
 ubburl=replace(s_string,"[/url]","
")
end function
function unquot(s_string)
 s_string=replace(s_string,chr(34),chr(34)&chr(34))
 unquot=replace(s_string,chr(39),chr(39)&chr(39))
end function
function fbdwords(s_string,s_fbdwords)
 a_string=split(s_fbdwords," ")
 n=ubound(a_string)
 for i=0 to n
  if trim(a_string(i))<>"" then
   s_string=replace(s_string,trim(a_string(i)),"*")
  end if
 next
 fbdwords=s_string
end function
function existswords(s_string,s_fbdwords)
 isexist=false
 a_string=split(s_fbdwords," ")
 n=ubound(a_string)
 for i=0 to n
  if trim(a_string(i))<>"" and instr(s_string,a_string(i))>0 then
   isexist=true
   exit for
  end if
 next
 existswords=isexist
end function
%>

热门栏目