Public class stringtools {
Public stringtools (){
}
// Obtain the pinyin code
Public String getpinym (string ){
// Chinese character location code
Int li_secposvalue [] = {1601,163 7, 1833,207 8, 2274,230 2, 2433,259 4,
2787,310 6, 3212,347 2, 3635,372 2, 3730,385 8,
4027,408 6, 4390,455 8, 4684,492 5, 5249,559 0 };
// Stores the pronunciation of the starting location code corresponding to different pronunciations of the first-level Chinese Character of the National Standard
Char lc_firstletter [] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'h ', 'J ',
'K', 'l', 'M', 'n', 'O', 'P', 'Q', 'R','s ',
'T', 'w', 'x', 'y', 'z '};
// Second-level font offset
Int ioffset = 0;
/// Store the pronunciation of all second-level Chinese characters of the National Standard
Java. Lang. String ls_secondsectable =
"Csf-gnspgcgne [Y [btyyzdxykygt [jnnjqmbsgzscyjsyy" +
"[Pgkbzgy [ywjkgkljywkpjqhy [W [weight" +
"[Phffss [ybgxlppbyll [hlxs [ZM [jhsojnghdzqyklgjhsgqzhxqgkezzwyscjxyeyxadzpmssmzjzqjyzc [J" +
"[Pipeline [" +
"[Rule" +
"[Rule" +
"Using [ykldyxzpylgg [mtcfpajjzyljtyanjgbjplqgdzyqy" +
"Province" +
"Listen [nnlhlyyqyhwzptczgwwmzffjqqqqyxaclbhkdjxdgmmydjxzllsygx" +
"Gkjrywzwyclzmssjzldbyd [fcxyhlxchyzjq [[Listen [[ttxrycyxbyhcsmxjsznpwgpxx1_bgajcxly" +
"[Limit [PQ" +
"[Rule" +
"Lxgsssstclsldclrpbhzhxyyfhb [gdmycnqqwlqhjj [assets [htzkzjecxjcjnmfby [sfywybjzgnysdzsqyrslj" +
"Authorization [yzgwkypsgxfzfcdkhjgxdl1_sgdslqwzkxtmhsbgzmjzrglyj" +
"Province" +
"Province" +
"Pipeline [cjddyygywrhjrtgz" +
"Pipeline [dxx" +
"Lhjhf [sxzqhfzmzcztqcxzxrttdjhnnyzqqmnqdmmg [Unknown" +
"Kmkmpcklgdbqtfzswtfgglyplljzhgj [empty" +
"Pipeline [djlsly" +
"Pipeline [cn1_mpdjgklcljbctbjddbblczqrppxjcjlzcshltoljnmdddlngkaqhqh" +
"Jgykheznmshrp [Protocol" +
"Province" +
"Province" +
"Province" +
"Success ";
Java. Lang. String sreturn = "";
For (Int J = 0; j <A. Length (); j ++ ){
String stemp = A. substring (J, J + 1 );
Byte [] by = new byte [2];
By = stemp. getbytes ();
If (by. Length = 1 ){
Sreturn = sreturn + stemp;
} Else {
Int IA = 96 + (INT) by [0]; // area code
Int IB = 96 + (INT) by [1]; // bit code
Int in = Ia * 100 + IB;
If (in> 1600 & in <5590 ){
For (INT I = 0; I <24; I ++ ){
If (in <li_secposvalue ){
Sreturn = sreturn + lc_firstletter;
Break;
}
}
} Else {
Ioffset = (IA-56) * 94 + IB-1;
If (ioffset> = 0 & ioffset <= 3007 ){
Sreturn = sreturn +
Ls_secondsectable.substring (ioffset,
Ioffset + 1 );
}
}
}
Sreturn = sreturn. tolowercase ();
}
Return sreturn;
}
Public static void main (string [] ARGs ){
System. Out. println (New stringtools (). getpinym ("Chinese character "));
}
}