改了一亿个东西,修了一亿个 BUG

This commit is contained in:
2021-10-19 17:42:18 +02:00
parent 5b907309e0
commit 888ddce4ef
40 changed files with 1870 additions and 1715 deletions

27
Utils/PinyinExtensions.cs Normal file
View File

@@ -0,0 +1,27 @@
using NPinyin;
using System;
namespace AnotherReplayReader.Utils
{
static class PinyinExtensions
{
public static bool ContainsIgnoreCase(this string self, string? s)
{
return s != null && self.IndexOf(s, StringComparison.CurrentCultureIgnoreCase) != -1;
}
public static string? ToPinyin(this string self)
{
string pinyin;
try
{
pinyin = Pinyin.GetPinyin(self);
}
catch
{
return null;
}
return pinyin.Replace(" ", "");
}
}
}