App_Code/Common.cs
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text.RegularExpressions;
/// <summary>
/// Common 的摘要说明
/// </summary>
public class Common
{
public Common()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
#region SHA1加密函数
public static string SHA1(string source)
{
return FormsAuthentication.HashPasswordForStoringInConfigFile(source, "SHA1");
}
#endregion
#region SQL防蛀函数
public static string UrnHtml(string strHtml)
{
strHtml = strHtml.Replace("'", "'").Replace(".", ".").Replace("%", "%").Replace("-", "-").Replace("<", " ");
return strHtml;
}
#endregion
#region 过滤字符串中所有的html标签
public static string checkStr(string text)
{
text = text.Trim();
if (string.IsNullOrEmpty(text))
return string.Empty;
text = Regex.Replace(text, "[\\s]{2,}", " "); //两个或多个空格替换为一个
text = Regex.Replace(text, "(<[b|B][r|R]/*>)+|(<[p|P](.|\\n)*?>)", "\n"); //<br>
text = Regex.Replace(text, "(\\s*&[n|N][b|B][s|S][p|P];\\s*)+", " "); //
text = Regex.Replace(text, "<(.|\\n)*?>", string.Empty); //其它任何标记
text = text.Replace("'", "''");
return text;
}//过滤字符串中所有的标签代码,如<img.../> ,<p></p>等
#endregion
#region 字符串截取函数
public static string subString(string str, int length)
{
string tmpStr = str;
int strLength = length;
if (str.Length > strLength)
{
tmpStr = str.Substring(0, strLength);
后面还有 96 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
