public string GetPYString(string str)
{
string tempStr = "";
foreach(char c in str)
{
if((int)c >=
{//字母和符號原樣保留
tempStr += c
}
else
{//累加拼音聲母
tempStr += GetPYChar(c
}
}
return tempStr;
}
/// <summary>
/// 取單個字符的拼音聲母
/// Code By MuseStudio@hotmail
///
/// </summary>
/// <param name="c">要轉換的單個漢字</param>
/// <returns>拼音聲母</returns>
public string GetPYChar(string c)
{
byte[] array = new byte[
array = System
int i = (short)(array[
if ( i <
if ( i <
if ( i <
if ( i <
if ( i <
if ( i <
if ( i <
if ( i <
if ( i <
if ( i <
if ( i <
if ( i <
if ( i <
if ( i <
if ( i <
if ( i <
if ( i <
if ( i <
if ( i <
if ( i <
if ( i <
if ( i <
if ( i <
if ( i <
return "*";
}
From:http://tw.wingwit.com/Article/program/net/201311/14325.html