App_Code/StringHelper.cs
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Security.Cryptography;
using System.IO;
using System.Configuration;
using System.Drawing;
/// <summary>
/// Summary description for StringHelper
/// </summary>
public class StringHelper
{
public static string convertStr(string text)
{
if (text == null)
{
text = "";
}
return text.Trim();
}
/// <summary>
/// 处理长度值
/// </summary>
/// <param name="text"></param>
/// <returns></returns>
public static string subStr(int length, string text)
{
if (text.Length >= length)
{
text = text.Substring(0, length) + " ...";
}
return text;
}
/// Method to make sure that user's inputs are not malicious
/// </summary>
/// <param name="text">User's Input</param>
/// <param name="maxLength">Maximum length of input</param>
/// <returns>The cleaned up version of the input</returns>
public static string InputText(string text, int maxLength)
{
text = text.Trim();
if (string.IsNullOrEmpty(text))
return string.Empty;
if (text.Length > maxLength)
text = text.Substring(0, maxLength);
text = Regex.Replace(text, "[\\s]{2,}", " "); //two or more spaces
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); //any other tags
text = text.Replace("'", "''");
return text;
}
/// <summary>
///SQL注入过滤
后面还有 121 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。