[Unity development tips] Unity Chinese to Pinyin

Heaven and earth are not benevolent and take all things as cud dogs, hello everyone, I am an imaginary world! Today, here is a record of Unity Chinese to Pinyin
. Welcome to the Unity industry QQ exchange group: 956187480 

Using the packaged dll, it is very convenient to use.   Download link https://download.csdn.net/download/qq_37310110/82719004

 private static string GetSpell(char chr)
    {
        var coverchr = Pinyin.GetPinyin(chr);

        bool isChineses = ChineseChar.IsValidChar(coverchr[0]);
        if (isChineses)
        {
            ChineseChar chineseChar = new ChineseChar(coverchr[0]);
            foreach (string value in chineseChar.Pinyins)
            {
                if (!string.IsNullOrEmpty(value))
                {
                    return value.Remove(value.Length - 1, 1);
                }
            }
        }
        return coverchr;

    }

 Download link https://download.csdn.net/download/qq_37310110/82719004

Welcome to the Unity industry QQ exchange group: 956187480

Guess you like

Origin blog.csdn.net/qq_37310110/article/details/121266469