The following methods are found on the Internet and feel useful (for example, you can combine Ajax techniques to find Chinese characters through Hanyu Pinyin).
But the following methods, many Chinese characters can not give a positive solution (such as "Xin Mao garden" "Xin"). Think about it, Chinese pronunciation have a lot of. Package sample;
public class Gb2alpha ... {
The letter Z uses two tags, here are 27 values
I, u, v do not make initials, follow the letters in front
Private char[] Chartable =
... {
' Ah ', ' ba ', ' Rub ', ' Ride ', ' moth ', ' hair ', ' karma ', ' ha ', ' ha ',
' Strike ', ' ka ', ' garbage ', ' Mom ', ' take ', ' Oh ', ' pop ', ' time ', ' yes ',
' Satan ', ' collapse ', ' collapse ', ' collapse ', ' dig ', ' Shake ', ' press ', ' turn ', ' seat '
};
Private char[] Alphatable =
... {
' A ', ' B ', ' C ', ' D ', ' E ', ' F ', ' G ', ' H ', ' I ',
' J ', ' K ', ' L ', ' M ', ' N ', ' O ', ' P ', ' Q ', ' R ',
' S ', ' T ', ' U ', ' V ', ' W ', ' X ', ' Y ', ' Z '
};
Private int[] table = new INT[27];
Class
... {
for (int i = 0; i < ++i) ... {
Table[i] = Gbvalue (Chartable[i]);
}
}
Public Gb2alpha () ... {
}
The main function, the input character, gets his initials,
English letters return the corresponding uppercase letters
Other non-Simplified Chinese characters return ' 0 '
Public char char2alpha (char ch) ... {
if (Ch >= ' a ' && ch <= ' z ')
Return (char) (CH-' a ' + ' a ');
if (ch >= ' A ' && ch <= ' Z ')
return ch;
int GB = Gbvalue (CH);
if (GB < table[0])
Return ' 0 ';
int i;
for (i = 0; i < 26;&n