天地不仁以萬物為刍狗,大家好我是幻世界!今天這裡記錄一下Unity中文轉拼音
歡迎加入Unity業内qq交流群:956187480
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;
}