/// <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); }
/// <summary> /// 获取每个字的首字母 /// </summary> /// <param name="hanzi"></param> /// <returns></returns> public static string GetFirstCodes(string hanzi) { return(Hanzi.GetFirstCodes(hanzi, "")); }
public static string ToPinyin(string hanzi) { return(Hanzi.ToPinyin(hanzi, 10)); }