Source File: PinyinUtil.java From jeewx with Apache License 2.0 6 votes /** * 汉字转换位汉语拼音首字母,英文字符不变 * * @param chines * 汉字 * @return 拼音 */ public static String converterToFirstSpell(String chines) { String pinyinName = ""; char[] nameChar = chines.toCharArray(...
示例1: converterToFirstSpell ▲点赞 3▼ importnet.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;//导入方法依赖的package包/类publicstaticStringconverterToFirstSpell(String chines){ String pinyinName ="";char[] nameChar = chines.toCharArray(); HanyuPinyinOutputFormat defaultFormat =new...
t2 = PinyinHelper.toHanyuPinyinStringArray(aT1, t3);// 将汉字的几种全拼都存到t2数组中t4.append(t2[0]);// 取出该汉字全拼的第一种读音并连接到字符串t4后}else{// 如果不是汉字字符,直接取出字符并连接到字符串t4后t4.append(Character.toString(aT1)); } } }catch(BadHanyuPinyi...
HanyuPinyinOutputFormat hanyuPinyinOutputFormat =newHanyuPinyinOutputFormat(); hanyuPinyinOutputFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE); hanyuPinyinOutputFormat.setVCharType(HanyuPinyinVCharType.WITH_V);try{ pinyin= PinyinHelper.toHanyuPinyinStringArray(zhWord,hanyuPinyinOutputFormat); }ca...
Log.e(TAG,"toPinYin: hanzi = "+hanzi );return"#"; } } 开发者ID:lijunyandev,项目名称:MeetMusic,代码行数:28,代码来源:ChineseToEnglish.java 示例5: converterToFirstSpell ▲点赞 3▼ importnet.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;//...