</summary>
[code=C#]
/// <summary>
/// 汉字拼音声母计算类
/// Write by WangZhenlong at 2003/11/29
/// 梁文刚于2009/03/26日对原作者的代码进行了改进
/// </summary>
public class F2GetPY
{
private F2GetPY() { }
/// <summary>
/// 获取一串汉字的拼音声母
/// </summary>
/// <param name="chinese">Unicode格式的汉字字符串</param>
/// <returns>拼音声母字符串</returns>
public static String GetPY(String chinese)
{
int _len = chinese.Length;
char[] buffer = new char[_len];
for (int i = 0; i < chinese.Length; i++)
{
buffer[i] = GetPY(chinese[i]);
}
//处理'\0'
char[] buff = new char[_len];
int k = 0;
for (int i = 0; i < _len; i++)
{
if (buffer[i] != '\0')
{