java获取拼音_java获取中文拼音

/**使用方法

String str = null;

try {

str = new String("猪八戒".getBytes(), "GBK");

}

catch (UnsupportedEncodingException ex) {

}

System.out.println("Spell=" + CnToSpell.getFullSpell(str));

*/

importjava.util.Iterator;

importjava.util.LinkedHashMap;

importjava.util.Set;

importjava.io.*;

/**

*

* @author new soul

*/

/**

*

汉字转化为全拼

*

JDK版本:

1.4

* @version 1.0

* @see

* @since 1.0

*/

@SuppressWarnings("unchecked")

publicclassCnToSpell {

privatestaticLinkedHashMap spellMap =null;

static{

if(spellMap ==null) {

spellMap =newLinkedHashMap(400);

}

initialize();

//      System.out.println("Chinese transfer Spell Done.");

}

privateCnToSpell() {

}

privatestaticvoidspellPut(String spell,intascii) {

spellMap.put(spell,newInteger(ascii));

}

privatestaticvoidinitialize() {

spellPut("a", -20319);

spellPut("ai", -20317);

spellPut("an", -20304);

spellPut("ang", -20295);

spellPut("ao", -20292);

spellPut("ba", -20283);

spellPut("bai", -20265);

spellPut("ban", -20257);

spellPut("bang", -20242);

spellPut("bao", -20230);

spellPut("bei", -20051);

spellPut("ben", -20036);

spellPut("beng", -20032);

spellPut("bi", -20026);

spellPut("bian", -20002);

spellPut("biao", -19990);

spellPut("bie", -19986);

spellPut("bin", -19982);

spellPut("bing", -19976);

spellPut("bo", -19805);

spellPut("bu", -19784);

spellPut("ca", -19775);

spellPut("cai", -19774);

spellPut("can", -19763);

spellPut("cang", -19756);

spellPut("cao", -19751);

spellPut("ce", -19746);

spellPut("ceng", -19741);

spellPut("cha", -19739);

spellPut("chai", -19728);

spellPut("chan", -19725);

spellPut("chang", -19715);

spellPut("chao", -19540);

spellPut("che", -19531);

spellPut("chen", -19525);

spellPut("cheng", -19515);

spellPut("chi", -19500);

spellPut("chong", -19484);

spellPut("chou", -19479);

spellPut("chu", -19467);

spellPut("chuai", -19289);

spellPut("chuan", -19288);

spellPut("chuang", -19281);

spellPut("chui", -19275);

spellPut("chun", -19270);

spellPut("chuo", -19263);

spellPut("ci", -19261);

spellPut("cong", -19249);

spellPut("cou", -19243);

spellPut("cu", -19242);

spellPut("cuan", -19238);

spellPut("cui", -19235);

spellPut("cun", -19227);

spellPut("cuo", -19224);

spellPut("da", -19218);

spellPut("dai", -19212);

spellPut("dan", -19038);

spellPut("dang", -19023);

spellPut("dao", -19018);

spellPut("de", -19006);

spellPut("deng", -19003);

spellPut("di", -18996);

spellPut("dian", -18977);

spellPut("diao", -18961);

spellPut("die", -18952);

spellPut("ding", -18783);

spellPut("diu", -18774);

spellPut("dong", -18773);

spellPut("dou", -18763);

spellPut("du", -18756);

spellPut("duan", -18741);

spellPut("dui", -18735);

spellPut("dun", -18731);

spellPut("duo", -1

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值