当前位置: 首页 > 新闻动态 > 软件编程

c#中文gbk编码查询示例代码

作者:用户投稿 浏览: 发布日期:2026-01-16
[导读]:c#中文gbk编码查询示例,大家参考使用吧

复制代码 代码如下:
private void button_Inquriy_Click(object sender, EventArgs e)
 {
     if (textBox_Inquiry.TextLength > 0)
     {
         String strInquiry = textBox_Inquiry.Text;
         byte[] bytes = Encoding.GetEncoding("GB2312").GetBytes(strInquiry);
         String strResult = String.Empty;
         foreach (byte b in bytes)
         {
             strResult += b.ToString("X2");
             strResult += " ";
         }
         textBox_Result.Text = strResult;
     }
     else
     {
         MessageBox.Show("请输入待查询的字符");
     }
 }

免责声明:转载请注明出处:http://shjed.com/news/252563.html

扫一扫高效沟通

多一份参考总有益处

免费领取网站策划SEO优化策划方案

请填写下方表单,我们会尽快与您联系
感谢您的咨询,我们会尽快给您回复!