From d64b4b5b0c27918281975f2260f8bc2d1d50c0d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?= Date: Fri, 11 Dec 2020 22:20:09 +0800 Subject: [PATCH] Change the way getting acronym --- Flow.Launcher.Infrastructure/PinyinAlphabet.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Flow.Launcher.Infrastructure/PinyinAlphabet.cs b/Flow.Launcher.Infrastructure/PinyinAlphabet.cs index d35250398..59bd897be 100644 --- a/Flow.Launcher.Infrastructure/PinyinAlphabet.cs +++ b/Flow.Launcher.Infrastructure/PinyinAlphabet.cs @@ -47,7 +47,11 @@ namespace Flow.Launcher.Infrastructure chineseIndexs.Add(i); } StringBuilder resultBuilder = new StringBuilder(); - resultBuilder.Append(string.Concat(resultList.Where((r, i) => chineseIndexs.Contains(i)).Select(s => s.First()))); + + foreach (var chineseIndex in chineseIndexs) + { + resultBuilder.Append(resultList[chineseIndex].First()); + } resultBuilder.Append(' '); int currentChineseIndex = 0; @@ -90,10 +94,5 @@ namespace Flow.Launcher.Infrastructure return content; } } - - private string GetFirstPinyinChar(string content) - { - return string.Concat(content.Split(' ').Select(x => x.First())); - } } } \ No newline at end of file