DBCS转化

public static String toDBCS(String s) {
if (s == null)
return "";
StringBuffer stringbuffer = new StringBuffer();
int i = 0;
for (int j = s.length(); i < j; i++) {
int k = s.charAt(i);
if (k >= 97 && k <= 122)
k = (k + 65345) - 97;
else if (k >= 65 && k <= 90)
k = (k + 65313) - 65;
else if (k >= 48 && k <= 57)
k = (k + 65296) - 48;
stringbuffer.append((char) k);
}

return stringbuffer.toString();
}

posted @ 2016-03-08 15:39  ComeOfCome  阅读(150)  评论(0编辑  收藏  举报