コード例 #1
0
        private bool ShouldDisplayPhrase(SelectableItem <Phrase> phrase)
        {
            string[] searchTerms = PhraseSearchTerm.Split(' ');
            string[] phraseParts = phrase.Item.Pinyin.Split(' ');

            return(searchTerms.All(searchTerm => phraseParts.Any(phrasePart => phrasePart.StartsWith(searchTerm))));
        }
コード例 #2
0
        private bool DisplayAny(Phrase phrase)
        {
            string[] searchTerms  = PhraseSearchTerm.Split(' ');
            string[] pinyinParts  = phrase.Pinyin.Split(' ');
            string[] englishParts = phrase.English.Split(' ');
            string[] hanziParts   = phrase.Hanzi.Split(' ');

            return(searchTerms.All(searchTerm => pinyinParts.Any(p => p.StartsWith(searchTerm)) || englishParts.Any(p => p.StartsWith(searchTerm)) || hanziParts.Any(p => p.StartsWith(searchTerm))));
        }