SenBiTeSolution.Common/StringHelp.cs
(完整代码) 1KBusing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SenBiTeSolution.Common
{
public partial class StringHelp
{
/// <summary>
/// 将指定的字符串按指定长度截取并加上指定的后缀
/// </summary>
/// <param name="oldStr">原字符串</param>
/// <param name="len">要截取的长度</param>
/// <param name="str">超出长度的后缀</param>
/// <returns></returns>
public static string CutString(string oldStr,int len,string str)
{
if (!string.IsNullOrEmpty(oldStr))
{
if (oldStr.Length>len)
{
string strTmp = oldStr.Substring(0, len);
if (string.IsNullOrEmpty(str))
{
return strTmp;
}
else
{
return strTmp + str;
}
}
else
{
return oldStr;
}
}
else
{
return "";
}
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。