問
程序中如何自動生成姓名拼音
答
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 Mu
///
/// </summary>
/// <param name=
/// <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/12595.html