LK.Shop.Common/Strings.cs
(完整代码) 1KBusing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace LK.Shop.Common
{
public static class Strings
{
/// <summary>
/// 过滤字符串中的html代码
/// </summary>
/// <param name="Str"></param>
/// <returns>返回过滤之后的字符串</returns>
public static string LostHTML(string Str)
{
string Re_Str = "";
if (Str != null)
{
if (Str != string.Empty)
{
string Pattern = "<\\/*[^<>]*>";
Re_Str = Regex.Replace(Str, Pattern, "");
}
}
return (Re_Str.Replace("\\r\\n", "")).Replace("\\r", "").Replace(" ", "");
}
///
/// left截取字符串
///
public static string Left(string sSource, int iLength)
{
return sSource.Substring(0, iLength > sSource.Length ? sSource.Length : iLength);
}
///
/// Right截取字符串
///
public static string Right(string sSource, int iLength)
{
return sSource.Substring(iLength > sSource.Length ? 0 : sSource.Length - iLength);
}
///
/// mid截取字符串
///
public static string Mid(string sSource, int iStart, int iLength)
{
int iStartPoint = iStart > sSource.Length ? sSource.Length : iStart;
return sSource.Substring(iStartPoint, iStartPoint + iLength > sSource.Length ? sSource.Length - iStartPoint : iLength);
}
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
