将中文转换为拼音字符串 (utils.encode_pinyin)
声明
拼音字母 = utils.encode_pinyin(中文内容, 分隔符)
参数及返回值
- 中文内容
- 文本型,需要转换为拼音的中文
- 分隔符
- 文本型,中文风格符号,默认为空
- 拼音字母
- 文本型,返回转换后的拼音字母
示例
- 转换中文为拼音
local o = utils.encode_pinyin("ATP真棒", '') --输出:ATPzhenbang print(o)
- 转换中文为拼音,并用-分割拼音
local o = utils.encode_pinyin("真棒", '-') --输出:zhen-bang print(o)