public string 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 [email protected]
/// 2004-11-30
/// </summary>
/// <param name="c">要轉換的單個漢字</param>
/// <returns>拼音聲母</returns>
public string GetPYChar(string c)
{
byte[] array = new byte[2];
array = System.Text.Encoding.Default.GetBytes(c);
int i = (short)(array[0] - ’