生成简体汉字C#

private string LocationCode(int ACode)
{
   
return Encoding.Default.GetString(
       
new byte[] { (byte)(ACode / 100 + 160), (byte)(ACode % 100 + 160) });
}

private void button1_Click(object sender, EventArgs e)
{
   
for (int i = 0; i < 1000; i++)
    {
       
string l = LocationCode(1601 + i);
       
if (l != "?") Console.Write(l);
    }
}

办法2,

    private   void   button10_Click(object   sender,   EventArgs   e)
                {
                        string   l="";
                        string   strtxt   =   "";
                                for   (int   i   =   0;   i   <   1000;   i++)
                                {
                                          l   =   LocationCode(1601   +   i);
                                          if   (l   !=   "?")   strtxt   =   strtxt   +   l;
                                }
                                label5.Text   =   strtxt;
                }
                private   string   LocationCode(int   ACode)
                {
                        return   Encoding.Default.GetString(
                                new   byte[]   {   (byte)(ACode   /   100   +   160),   (byte)(ACode   %   100   +   160)   });
                }
 
原文地址:https://www.cnblogs.com/whitetiger/p/1081484.html