namespace ZonyLrcTools.Common.Infrastructure.Extensions
{
///
/// 字符串处理相关的工具方法。
///
public static class StringHelper
{
///
/// 截断指定字符串末尾的匹配字串。
///
/// 待截断的字符串。
/// 需要在末尾截断的字符串。
/// 截断成功的字符串实例。
public static string TrimEnd(this string @string, string trimEndStr)
{
if (@string.EndsWith(trimEndStr, StringComparison.Ordinal))
{
return @string.Substring(0, @string.Length - trimEndStr.Length);
}
return @string;
}
}
}