///
汉字转拼音缩写
/// Code By MuseStudio@hotmail.com
/// 2004-11-30
/// </summary>
/// <param name="str"> 要转换的汉字字符串 </param>
/// <returns> 拼音缩写 </returns>
public static 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 MuseStudio@hotmail.com
/// 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 ] - '
/// Code By MuseStudio@hotmail.com
/// 2004-11-30
/// </summary>
/// <param name="str"> 要转换的汉字字符串 </param>
/// <returns> 拼音缩写 </returns>
public static 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 MuseStudio@hotmail.com
/// 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 ] - '