标签:简繁转换

找了好长一段时间,原文请参考以下地址:

java 实现繁简字体转换(笨方法):http://www.javaeye.com/topic/261542?page=1

javabean:gb2big.java

// Created on 2009-4-13

package util;
public class gb2big
{
String shortChar = “万与丑专业丛东丝….”; //这里输出不完,请从网上的javascript找到完整字库
String longChar = “萬與醜專業叢東絲….”;

public String gb2big(String str)
{
String outputStirng = “”;
for (int i = 0; i < str.length(); i++)
{
if(shortChar.indexOf(str.charAt(i)) != -1)
{
outputStirng += longChar.charAt(shortChar.indexOf(str.charAt(i)));
}
else
{
outputStirng += str.charAt(i);
}
}
return outputStirng;
}
}

测试页面:test.jsp

test