merge one extra condition to the switch case

This commit is contained in:
弘韬 张 2020-10-18 21:24:59 +08:00
parent c63c98645c
commit e264af500f

View file

@ -76,16 +76,11 @@ namespace Flow.Launcher.Infrastructure
if (currentQueryIndex >= queryWithoutCase.Length)
break;
if (compareIndex == 0 && queryWithoutCase[currentQueryIndex] == char.ToLower(stringToCompare[compareIndex]))
{
acronymMatchData.Add(compareIndex);
currentQueryIndex++;
continue;
}
switch (stringToCompare[compareIndex])
{
case char c when (char.IsUpper(c) && char.ToLower(c) == queryWithoutCase[currentQueryIndex])
case char c when compareIndex == 0 && queryWithoutCase[currentQueryIndex] == char.ToLower(stringToCompare[compareIndex])
|| (char.IsUpper(c) && char.ToLower(c) == queryWithoutCase[currentQueryIndex])
|| (char.IsWhiteSpace(c) && char.ToLower(stringToCompare[++compareIndex]) == queryWithoutCase[currentQueryIndex]):
acronymMatchData.Add(compareIndex);
currentQueryIndex++;