Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

ubb function

// description of your code here

Function UBB(str) 

dim i,temp ‘声明�� 

i=1 

temp="" 

do while instr(i,str,"[/"]>=1 ‘如果没有达到字符串的末尾 

if trim(temp)="" then 

temp=ReplaceTest("(\)(\S+)(\ )",str,"<i>$2</i>")  ‘进行UBB代�的模版匹�与替� 

else 

temp=ReplaceTest("(\)(\S+)(\ )",temp,"<i>$2</i>")  ‘进行UBB代�的模版匹�与替� 

end if 

temp=ReplaceTest("(\)(\S+)(\ )",temp,"<b>$2</b>")  ‘进行UBB代�的模版匹�与替� 

temp=ReplaceTest("(\[big])(\S+)(\[/big])",temp,"<big>$2</big>") ‘进行UBB代�的模版匹�与替� 

temp=ReplaceTest("(\[strike])(\S+)(\[/strike])",temp,"<strike>$2</strike>")‘进行UBB代�的模版匹�与替� 

temp=ReplaceTest("(\[sub])(\S+)(\[/sub])",temp,"<sub>$2</sub>")‘进行UBB代�的模版匹�与替� 

temp=ReplaceTest("(\[sup])(\S+)(\[/sup])",temp,"<sup>$2</sup>") 

temp=ReplaceTest("(\[pre])(\S+)(\[/pre])",temp,"<pre>$2</pre>") 

temp=ReplaceTest("(\[u])(\S+)(\[/u])",temp,"<u>$2</u>") 

temp=ReplaceTest("(\[small])(\S+)(\[/small])",temp,"<small>$2</small>") 

temp=ReplaceTest("(\[h1])(\S+)(\[/h1])",temp,"<h1>$2</h1>") 

temp=ReplaceTest("(\[h2])(\S+)(\[/h2])",temp,"<h2>$2</h2>") 

temp=ReplaceTest("(\[h3])(\S+)(\[/h3])",temp,"<h3>$2</h3>") 

temp=ReplaceTest("(\[h4])(\S+)(\[/h4])",temp,"<h4>$2</h4>") 

temp=ReplaceTest("(\[h5])(\S+)(\[/h5])",temp,"<h5>$2</h5>") 

temp=ReplaceTest("(\[h6])(\S+)(\[/h6])",temp,"<h6>$2</h6>") 

temp=ReplaceTest("(\[red])(\S+)(\[/red])",temp,"<font color=red>$2</font>") 

'这里�以增加新的UBB代�的实现模版 

temp=ReplaceTest("(\[email])(\S+)(\[/email])",temp,"<a href=""mailto:$2"" target=_top>$2</a>") 

temp=ReplaceTest("(\[img])(\S+)(\[/img])",temp,"<img src=""$2"">") 

temp=ReplaceTest("(\[url])(\S+)(\[/url])",temp,"<a href=""$2"" target=_top>$2</a>") 

temp=ReplaceTest("(\[#(\S+)])(\S+)(\[/#])",temp,"<font color=$1>$3</font>")‘进行UBB代�的模版匹�与替� 

i=i+1 

loop 

if trim(temp)<>"" then 

UBB=temp ‘将�过UBB代�过滤�的字符串传出 

else 

UBB=str  ‘将�过UBB代�过滤�的字符串传出 

end if 

end function 

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS