赞
踩
implementation 'com.belerweb:pinyin4j:2.5.0'
import net.sourceforge.pinyin4j.PinyinHelper object PinyinUtils { fun getUpperFirstWord(s:String): String { val pinyinArray = PinyinHelper.toHanyuPinyinStringArray(s[0]) return if (pinyinArray == null) { if (s[0] in 'a'..'z' || s[0] in 'A'..'Z') { s[0].uppercase() } else { "#" } } else { pinyinArray[0][0].uppercase() } } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。