}
String text = from.getText();
to.setText(CnToSpell.getFullSpell(text));
c.pack();
}
}
public static void main(String [] args) {
CnToSpell2GUI g = new CnToSpell2GUI();
}
}
------------------------------------------------------------------------
/**
* @(#)CnToSpell.java
* 版权声明 Easydozer 版权所有 违者必究
*
* 修订记录:
* 1)更改者:Easydozer
* 时 间:2004-10-20
* 描 述:创建
*/
package com.easydozer.commons.util;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Set;
/**
*
汉字转化为全拼
*
- JDK版本:
- 1.4
* @author 谢计生
* @version 1.0
* @see
* @since 1.0
*/
public class CnToSpell
{
private static LinkedHashMap spellMap = null;
static
{
if(spellMap == null){
spellMap = new LinkedHashMap(400);
}
initialize();
System.out.println("Chinese transfer Spell Done.");
}
private CnToSpell()
{
}
private static void spellPut(String spell,int ascii)
{
spellMap.put(spell,new Integer(ascii));
}
private static void initialize()
{
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);

