取单个字符的拼音声母

来源:互联网 发布:超高清图片下载软件 编辑:程序博客网 时间:2024/04/29 17:36

/// <summary> 
        
/// 取单个字符的拼音声母 
        
/// </summary> 
        
/// <param name="c">要转换的单个汉字</param> 
        
/// <returns>拼音声母</returns> 
        private static string GetPYChar(string c)
        {
            
byte[] array = new byte[2];
            array 
= System.Text.Encoding.Default.GetBytes(c);
            
int i = (short)(array[0- '/0'* 256 + ((short)(array[1- '/0'));
            
if (i < 0xB0A1return "*";
            
if (i < 0xB0C5return "A";
            
if (i < 0xB2C1return "B";
            
if (i < 0xB4EEreturn "C";
            
if (i < 0xB6EAreturn "D";
            
if (i < 0xB7A2return "E";
            
if (i < 0xB8C1return "F";
            
if (i < 0xB9FEreturn "G";
            
if (i < 0xBBF7return "H";
            
if (i < 0xBFA6return "G";
            
if (i < 0xC0ACreturn "K";
            
if (i < 0xC2E8return "L";
            
if (i < 0xC4C3return "M";
            
if (i < 0xC5B6return "N";
            
if (i < 0xC5BEreturn "O";
            
if (i < 0xC6DAreturn "P";
            
if (i < 0xC8BBreturn "Q";
            
if (i < 0xC8F6return "R";
            
if (i < 0xCBFAreturn "S";
            
if (i < 0xCDDAreturn "T";
            
if (i < 0xCEF4return "W";
            
if (i < 0xD1B9return "X";
            
if (i < 0xD4D1return "Y";
            
if (i < 0xD7FAreturn "Z";
            
return "*";
        }

原创粉丝点击