Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
        private static string Hanzi2Pinyin(string hanzi)
        {
            string py = Pinyin4Name.GetPinyin(hanzi);

            return(py);
        }