日期:2014-05-19  浏览次数:20424 次

高分!高分!!要的来拿!
请问在ASP.NET页面中如何调用这个UBB类
各位大师能不能给个完整的示例
using   System;
using   System.Text;
using   System.Text.RegularExpressions;
namespace   Test.Com
{
///   <summary>
  ///   功能:UBB代码
  ///   作者:Rexsp
  ///   日期:2004-4-6
  ///   </summary>
  public   class   UBB
  {
    #region   构造函数
    public   UBB()
    {
      //
      //   TODO:   在此处添加构造函数逻辑
      //
    }
    #endregion
    #region   公共静态方法
    ///   <summary>
    ///   UBB代码处理函数
    ///   </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标记符
      sDetail   =   sDetail.Replace( " < ", "&lt; ");
      sDetail   =   sDetail.Replace( "> ", "&gt; ");
      #endregion
      #region   处[b][/b]标记
      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]标记
      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]标记
      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]标记
      //处[p][/p]标记