最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

asp.net ubb使用代碼

 更新時間:2009年12月22日 22:26:19   作者:  
asp.net ubb使用代碼,以前腳本之家曾經(jīng)發(fā)過一篇稍有區(qū)別的代碼,大家一起參考下吧。
復(fù)制代碼 代碼如下:

////別人寫的ubb代碼

using System;
using System.Text;
using System.Text.RegularExpressions;
namespace Test.Com
{
/// <summary>
/// 功能:UBB代碼
/// 作者:Rexsp
/// 日期:2004-4-6
/// </summary>
public class UBB
{
#region 構(gòu)造函數(shù)
public UBB()
{
//
// TODO: 在此處添加構(gòu)造函數(shù)邏輯
//
}
#endregion
#region 公共靜態(tài)方法
/// <summary>
/// UBB代碼處理函數(shù)
/// </summary>
/// <param name="sDetail">輸入字符串</param>
/// <returns>輸出字符串</returns>
public static string UBBToHTML(string sDetail)
{
Regex r;
Match m;
#region 處理空格
sDetail = sDetail.Replace(" ","&nbsp;");
#endregion
#region html標(biāo)記符
sDetail = sDetail.Replace("<","&lt;");
sDetail = sDetail.Replace(">","&gt;");
#endregion
#region 處[b][/b]標(biāo)記
r = new Regex(@"(\[b\])([ \S\t]*?)(\[\/b\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<B>" + m.Groups[2].ToString() + "</B>");
}
#endregion
#region 處[i][/i]標(biāo)記
r = new Regex(@"(\[i\])([ \S\t]*?)(\[\/i\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<I>" + m.Groups[2].ToString() + "</I>");
}
#endregion
#region 處[u][/u]標(biāo)記
r = new Regex(@"(\[U\])([ \S\t]*?)(\[\/U\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<U>" + m.Groups[2].ToString() + "</U>");
}
#endregion
#region 處[p][/p]標(biāo)記
//處[p][/p]標(biāo)記
r = new Regex(@"((\r\n)*\[p\])(.*?)((\r\n)*\[\/p\])",RegexOptions.IgnoreCase|RegexOptions.Singleline);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<P class=\"pstyle\">" + m.Groups[3].ToString() + "</P>");
}
#endregion
#region 處[sup][/sup]標(biāo)記
//處[sup][/sup]標(biāo)記
r = new Regex(@"(\[sup\])([ \S\t]*?)(\[\/sup\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<SUP>" + m.Groups[2].ToString() + "</SUP>");
}
#endregion
#region 處[sub][/sub]標(biāo)記
//處[sub][/sub]標(biāo)記
r = new Regex(@"(\[sub\])([ \S\t]*?)(\[\/sub\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<SUB>" + m.Groups[2].ToString() + "</SUB>");
}
#endregion
#region 處[url][/url]標(biāo)記
//處[url][/url]標(biāo)記
r = new Regex(@"(\[url\])([ \S\t]*?)(\[\/url\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<A href=\"" + m.Groups[2].ToString() + "\" target=\"_blank\"><IMG border=0 src=\"images/url.gif\">" +
m.Groups[2].ToString() + "</A>");
}
#endregion
#region 處[url=xxx][/url]標(biāo)記
//處[url=xxx][/url]標(biāo)記
r = new Regex(@"(\[url=([ \S\t]+)\])([ \S\t]*?)(\[\/url\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<A href=\"" + m.Groups[2].ToString() + "\" target=\"_blank\"><IMG border=0 src=\"images/url.gif\">" +
m.Groups[3].ToString() + "</A>");
}
#endregion
#region 處[email][/email]標(biāo)記
//處[email][/email]標(biāo)記
r = new Regex(@"(\[email\])([ \S\t]*?)(\[\/email\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<A href=\"mailto:" + m.Groups[2].ToString() + "\" target=\"_blank\"><IMG border=0 src=\"images/email.gif\">" +
m.Groups[2].ToString() + "</A>");
}
#endregion
#region 處[email=xxx][/email]標(biāo)記
//處[email=xxx][/email]標(biāo)記
r = new Regex(@"(\[email=([ \S\t]+)\])([ \S\t]*?)(\[\/email\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<A href=\"mailto:" + m.Groups[2].ToString() + "\" target=\"_blank\"><IMG border=0 src=\"images/email.gif\">" +
m.Groups[3].ToString() + "</A>");
}
#endregion
#region 處[size=x][/size]標(biāo)記
//處[size=x][/size]標(biāo)記
r = new Regex(@"(\[size=([1-7])\])([ \S\t]*?)(\[\/size\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<FONT SIZE=" + m.Groups[2].ToString() + ">" +
m.Groups[3].ToString() + "</FONT>");
}
#endregion
#region 處[color=x][/color]標(biāo)記
//處[color=x][/color]標(biāo)記
r = new Regex(@"(\[color=([\S]+)\])([ \S\t]*?)(\[\/color\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<FONT COLOR=" + m.Groups[2].ToString() + ">" +
m.Groups[3].ToString() + "</FONT>");
}
#endregion
#region 處[font=x][/font]標(biāo)記
//處[font=x][/font]標(biāo)記
r = new Regex(@"(\[font=([\S]+)\])([ \S\t]*?)(\[\/font\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<FONT FACE=" + m.Groups[2].ToString() + ">" +
m.Groups[3].ToString() + "</FONT>");
}
#endregion
#region 處理圖片鏈接
//處理圖片鏈接
r = new Regex("\\[picture\\](\\d+?)\\[\\/picture\\]",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<A href=\"ShowImage.aspx?Type=ALL&Action=forumImage&ImageID=" + m.Groups[1].ToString() +
"\" target=\"_blank\"><IMG border=0 Title=\"點擊打開新窗口查看\" src=\"ShowImage.aspx?Action=forumImage&ImageID=" + m.Groups[1].ToString() +
"\"></A>");
}
#endregion
#region 處理[align=x][/align]
//處理[align=x][/align]
r = new Regex(@"(\[align=([\S]+)\])([ \S\t]*?)(\[\/align\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<P align=" + m.Groups[2].ToString() + ">" +
m.Groups[3].ToString() + "</P>");
}
#endregion
#region 處[H=x][/H]標(biāo)記
//處[H=x][/H]標(biāo)記
r = new Regex(@"(\[H=([1-6])\])([ \S\t]*?)(\[\/H\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<H" + m.Groups[2].ToString() + ">" +
m.Groups[3].ToString() + "</H" + m.Groups[2].ToString() + ">");
}
#endregion
#region 處理[list=x][*][/list]
//處理[list=x][*][/list]
r = new Regex(@"(\[list(=(A|a|I|i| ))?\]([ \S\t]*)\r\n)((\[\*\]([ \S\t]*\r\n))*?)(\[\/list\])",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
string strLI = m.Groups[5].ToString();
Regex rLI = new Regex(@"\[\*\]([ \S\t]*\r\n?)",RegexOptions.IgnoreCase);
Match mLI;
for (mLI = rLI.Match(strLI); mLI.Success; mLI = mLI.NextMatch())
{
strLI = strLI.Replace(mLI.Groups[0].ToString(),"<LI>" + mLI.Groups[1]);
}
sDetail = sDetail.Replace(m.Groups[0].ToString(),
"<UL TYPE=\"" + m.Groups[3].ToString() + "\"><B>" + m.Groups[4].ToString() + "</B>" +
strLI + "</UL>");
}
#endregion
#region 處理換行
//處理換行,在每個新行的前面添加兩個全角空格
r = new Regex(@"(\r\n((&nbsp;)| )+)(?<正文>\S+)",RegexOptions.IgnoreCase);
for (m = r.Match(sDetail); m.Success; m = m.NextMatch())
{
sDetail = sDetail.Replace(m.Groups[0].ToString(),"<BR>  " + m.Groups["正文"].ToString());
}
//處理換行,在每個新行的前面添加兩個全角空格
sDetail = sDetail.Replace("\r\n","<BR>");
#endregion
return sDetail;
}
#endregion
}
}


asp.net(c#) ubb處理類
http://m.fzitv.net/article/15615.htm

相關(guān)文章

  • .Net?7.0實現(xiàn)支付寶退款和結(jié)果查詢接口

    .Net?7.0實現(xiàn)支付寶退款和結(jié)果查詢接口

    支付寶對 .Net 的支持還是比較充分的,在每個接口文檔中都有關(guān)于 C# 語言的示例,這樣就大大降低了對接的難度,很容易上手,這篇文章主要介紹了支付寶退款和結(jié)果查詢接口簡單實現(xiàn)(.Net?7.0),需要的朋友可以參考下
    2024-07-07
  • .NET通過字典給類賦值實現(xiàn)代碼

    .NET通過字典給類賦值實現(xiàn)代碼

    這篇文章主要介紹了.NET通過字典給類賦值實現(xiàn)代碼,代碼簡單易懂,非常不錯,具有參考借鑒價值,需要的朋友可以參考下
    2016-09-09
  • asp.net 無刷新翻頁就是這么簡單

    asp.net 無刷新翻頁就是這么簡單

    前兩天看了一個自定義分頁控件,和AspNetPager一樣是實現(xiàn)IPostBackEventHandler接口,不過簡潔許多,就想能不能實現(xiàn)ICallbackEventHandler接口做到無刷新分頁呢?想到了就馬上去做,終于,設(shè)想變成了現(xiàn)實??!
    2010-03-03
  • asp.net 未能寫入輸出文件--“拒絕訪問的解決辦法

    asp.net 未能寫入輸出文件--“拒絕訪問的解決辦法

    這個是網(wǎng)站部署在IIS7上出現(xiàn)的一個問題
    2012-12-12
  • ASP.NET Core 導(dǎo)入導(dǎo)出Excel xlsx 文件實例

    ASP.NET Core 導(dǎo)入導(dǎo)出Excel xlsx 文件實例

    本篇文章主要介紹了ASP.NET Core 導(dǎo)入導(dǎo)出Excel xlsx 文件,非常具有實用價值,需要的朋友可以參考下。
    2016-12-12
  • ASP.NET?Core?6.0?基于模型驗證的數(shù)據(jù)驗證功能

    ASP.NET?Core?6.0?基于模型驗證的數(shù)據(jù)驗證功能

    這篇文章主要介紹了ASP.NET?Core?6.0?基于模型驗證的數(shù)據(jù)驗證,本文描述的數(shù)據(jù)驗證方案,是基于官方的模型驗證(Model validation),需要的朋友可以參考下
    2022-07-07
  • ASP.NET MVC4使用MongoDB制作相冊管理

    ASP.NET MVC4使用MongoDB制作相冊管理

    這篇文章主要介紹了ASP.NET MVC4使用MongoDB制作相冊管理的相關(guān)資料,感興趣的小伙伴們可以參考一下
    2016-07-07
  • SignalR Self Host+MVC等多端消息推送服務(wù)(二)

    SignalR Self Host+MVC等多端消息推送服務(wù)(二)

    這篇文章主要為大家詳細(xì)介紹了SignalR Self Host+MVC等多端消息推送服務(wù)的第二篇,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-06-06
  • ASP.NET MVC異常過濾器用法

    ASP.NET MVC異常過濾器用法

    本文詳細(xì)講解了ASP.NET MVC異常過濾器的用法,文中通過示例代碼介紹的非常詳細(xì)。對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2022-03-03
  • ASP.NET中制作各種3D圖表的方法

    ASP.NET中制作各種3D圖表的方法

    這篇文章主要給大家介紹如何在ASP.NET中如何制作3D圖表。大家都知道圖表在ASP.NET技術(shù)中是一種特別受歡迎而又很重要的工具。圖表是表示數(shù)據(jù)的圖形,一般含有X和Y兩個坐標(biāo)軸。我們可以用折線,柱狀,塊狀來表示數(shù)據(jù)。下面通過本文來一起學(xué)習(xí)下各種3D圖表的制作過程吧。
    2016-10-10

最新評論

宁海县| 陆川县| 平塘县| 安阳县| 寻甸| 乌拉特中旗| 岚皋县| 开封市| 罗定市| 广汉市| 漠河县| 临沧市| 新巴尔虎左旗| 闻喜县| 菏泽市| 阿城市| 兴业县| 威宁| 海门市| 桂平市| 福建省| 老河口市| 大英县| 锦屏县| 镇沅| 铁岭县| 东乌珠穆沁旗| 类乌齐县| 托克托县| 宜丰县| 铜鼓县| 三门县| 莒南县| 个旧市| 都江堰市| 旅游| 阳曲县| 黑山县| 子洲县| 石首市| 茂名市|