'Maven引入相关的罐子
<depenncy> <groupId> .belweb </groupid> <ArtifictId> pinyin4j </artifactidid> <版本> 2
pinyin4julit
软件包co.os.core.util.util.importr; import net.sourceforge.pinyin4j.pinyinloper; sourceforge.pinyin4j.format.hanucinyincaseType; immport; immport net.sourceforge.pinyin4j.format.hanyutinyIntoneType; isOurceforge.pinyin4j.format.exception.badhanyupinynoutputputputputputputputpuformatcombinati; isMport java.arrayist; arrayist;静态void main(string [] args){字符串strg =“ string piny4444444jutil.convertertospell(str); system.uut.println(str +“ pin yin yin:” + pinyin:“ + pinyin); pinyin = pinyin4jutil.convertertofirstttttttttttttttttttttttttttttttttttttttttttttttlln yin.utrintln yut yut + yut + yutrint + yutrint +” Pinyin) + PINYIN) + PYIN);} /** US不变בֿ特殊字夗夦cssc,ZSSS,ZSSC,CSSZZ,* @retest Chines转换Convertrn Chiness Convertrn Convertrring converttrring = new hanucinyOutputformat(); namechar [i],defaultformat); pinyinname.append(namechar [s]); parsethinesebject(iScountthechinese(Pintyinname.tostringing());} /** 汉字转捬捽汉语全拼ﭗ字 us不变us不变ense特殊字quen摭defaultformat.setCaseType(hanyutyyincasetype.lorwercase); (strs!= null){for(int j = 1; j <strs; j +++){pinyname.append(strs [j]); if(j!= strs.length -1){pinyinname.append(“ pinyinname.append(namechar [s]);} pinkinname.append(“)”} //返回integerchinese(字符串thestry){//去除钐拼拼音后的拼音列表列表<spring,integer> integer> = new arraylist <string,integer >>() integer>(); string []中国maplist.Add(仅一个);}返回磁带 * @return * (first!= null){ /取出上欻合丄steryscífor(字符串scíforscí(scíscífors(stringscíommíoforyfory sever)。 0){clare() “,”);}} if(returnstr.length()0){returnstrester = returnstrestrest.substring(0,returnstrest() - 1);以上这伫使用pinyin4cy星期日。