/// <Summary>
/// Abbreviated Chinese character to PinYin
//// Code by MuseStudio@hotmail.com
///// 2004-11-30 /// </Summary> /// <Param name = "str"> Chinese character string to be converted </param>
///// <Returns> pinyin abbreviation </returns>
Public String getpystring (string Str)
{
String tempstr = "";
Foreach (char C in Str)
{If (INT) C >=33 & (INT) C <= 126)
{// Reserved letters and symbols
Tempstr + = C. tostring ();
} Else
{// Accumulate the pinyin initials
Tempstr + = getpychar (C. tostring ());
}
}
Return tempstr;
}
/// <Summary>
///// Specifies the initials of a single character. // code by MuseStudio@hotmail.com
///// 2004-11-30 /// </Summary> /// <Param name = "C"> single Chinese character to be converted </param>
////// <Returns> pinyin initials </returns>
Public String getpychar (string C)
{
Byte [] array = new byte [2];
Array = system. Text. encoding. Default. getbytes (C );
Int I = (short) (array [0]-'\ 0') * 256 + (short) (array [1]-' \ 0 '));
If (I <0xb0a1) Return "*";
If (I <0xb0c5) Return "";
If (I <0xb2c1) Return "B ";
If (I <0xb4ee) Return "C ";
If (I <0xb6ea) Return "D ";
If (I <0xb7a2) Return "E ";
If (I <0xb8c1) Return "F ";
If (I <0xb9fe) Return "G ";
If (I <0xbbf7) Return "H ";
If (I <0xbfa6) Return "G ";
If (I <0xc0ac) Return "K ";
If (I <0xc2e8) Return "L ";
If (I <0xc4c3) Return "M ";
If (I <0xc5b6) Return "N ";
If (I <0xc5be) Return "O ";
If (I <0xc6da) Return "p ";
If (I <0xc8bb) Return "Q ";
If (I <0xc8f6) Return "R ";
If (I <0 xcbfa) Return "S ";
If (I <0 xcdda) Return "T ";
If (I <0xcef4) Return "W ";
If (I <0xd1b9) Return "X ";
If (I <0xd4d1) Return "Y ";
If (I <0xd7fa) Return "Z ";
Return "*";
}
Other references: http://study.okshare.net/it/IT11/Article_13915.html
Http://www.hur.cn/bbs/dispbbs.asp? Boardid = 2 & id = 48862 & page = 1
Http://bbs.veryer.com/2434/ShowPost.aspxUse C # To obtain the first letter of Chinese Characters