示例#1
0
        /// <summary>
        /// 获取每个字的首字母(以split分隔)
        /// </summary>
        /// <param name="hanzi"></param>
        /// <param name="split"></param>
        /// <returns></returns>
        public static string GetFirstCodes(string hanzi, string split)
        {
            string text = "";

            char[] array = Hanzi.ToPinyin(hanzi, 10000000).ToCharArray();
            for (int i = 0; i < array.Length; i++)
            {
                char c = array[i];
                if (c >= 'A' && c <= 'Z')
                {
                    if (text.Length > 0)
                    {
                        text += split;
                    }
                    text += c.ToString();
                }
            }
            return(text);
        }
示例#2
0
 /// <summary>
 /// 获取每个字的首字母
 /// </summary>
 /// <param name="hanzi"></param>
 /// <returns></returns>
 public static string GetFirstCodes(string hanzi)
 {
     return(Hanzi.GetFirstCodes(hanzi, ""));
 }
示例#3
0
 public static string ToPinyin(string hanzi)
 {
     return(Hanzi.ToPinyin(hanzi, 10));
 }