///<summary>
/// 汉字转拼音缩写
/// Code By
/// 2004-11-30
///</summary>
///<param name="str">要转换的汉字字符串</param>
///<returns>拼音缩写</returns>
publicstring GetPYString(string str)
{
string tempStr ="";
foreach(char c in str)
{
if((int)c >=33&& (int)c <=126)
{//字母和符号原样保留
tempStr += c.ToString();
}
else
{//累加拼音声母
tempStr += GetPYChar(c.ToString());
}
}
return tempStr;
}
///<summary>
/// 取单个字符的拼音声母
/// Code By
/// 2004-11-30
///</summary>
///<param name="c">要转换的单个汉字</param>
///<returns>拼音声母</returns>
publicstring GetPYChar(string c)
{
byte[] array =newbyte[2];
array = System.Text.Encoding.Default.GetBytes(c);
int i = (short)(array[0] -'