Encode/Decode

 #region Encode/Decode
  
  public static string HtmlDecode( String textToFormat )
  {
   if ( IsNullorEmpty ( textToFormat ) )
    return textToFormat;
   return System.Web.HttpUtility.HtmlDecode ( textToFormat );
  }

  public static string HtmlEncode( String textToFormat )
  {
   if ( IsNullorEmpty ( textToFormat ) )
    return textToFormat;
   return System.Web.HttpUtility.HtmlEncode ( textToFormat );
  }

  public static string UrlEncode( string urlToEncode )
  {
   if ( IsNullorEmpty ( urlToEncode ) )
    return urlToEncode;
   return System.Web.HttpUtility.UrlEncode ( urlToEncode );
  }
  public static string UrlDecode( string encodeUrl )
  {
   if ( IsNullorEmpty ( encodeUrl ) )
    return encodeUrl;
   return System.Web.HttpUtility.UrlDecode ( encodeUrl );
  }
  #endregion

posted @ 2012-02-16 09:48  周正明  阅读(201)  评论(0)    收藏  举报