/// <summary> /// 判断读音 /// </summary> /// <param name="hanzi"></param> /// <param name="expected"></param> private void HanziAssert(string hanzi, string expected) { var actual = Pinyin4Name.GetPinyin(hanzi); Assert.AreEqual(expected, actual); }
/// <summary> /// 判断拼音格式 /// </summary> /// <param name="hanzi"></param> /// <param name="expected"></param> /// <param name="format"></param> private void PinyinFormatAssert(string hanzi, string expected, PinyinFormat format) { var fmted = Pinyin4Name.GetPinyin(hanzi, format); Assert.AreEqual(expected, fmted); }
private static string Hanzi2Pinyin(string hanzi) { string py = Pinyin4Name.GetPinyin(hanzi); return(py); }