Ejemplo n.º 1
0
        private static char[] GetFirstWordByCh(char singleChinese)
        {
            ChineseChar ch;
            List <char> list = new List <char>();

            if (singleChinese < '\x007f')
            {
                list.Add(char.ToUpper(singleChinese));
                return(list.ToArray());
            }
            try
            {
                ch = new ChineseChar(singleChinese);
            }
            catch
            {
                return(null);
            }
            if (ch.get_PinyinCount() < 1)
            {
                return(null);
            }
            ReadOnlyCollection <string> onlys = ch.get_Pinyins();

            for (int i = 0; i < ch.get_PinyinCount(); i++)
            {
                if (!list.Contains(onlys[i][0]))
                {
                    list.Add(onlys[i][0]);
                }
            }
            return(list.ToArray());
        }