refactor: Common components are moved to the Common library.

This commit is contained in:
real-zony
2022-10-06 13:02:20 +08:00
parent ecab0e0f5c
commit 740e8f4c63
64 changed files with 84 additions and 150 deletions

View File

@@ -0,0 +1,24 @@
namespace ZonyLrcTools.Common.Infrastructure.Extensions
{
/// <summary>
/// 字符串处理相关的工具方法。
/// </summary>
public static class StringHelper
{
/// <summary>
/// 截断指定字符串末尾的匹配字串。
/// </summary>
/// <param name="string">待截断的字符串。</param>
/// <param name="trimEndStr">需要在末尾截断的字符串。</param>
/// <returns>截断成功的字符串实例。</returns>
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;
}
}
}