当前位置: 首页 > article >正文

c# 字符串转换为byte

c# 字符串转换为byte

using System.Text;
class proj
{
    internal static void Main(string[] args)
    {
        byte[] a=new byte[3];
        Console.WriteLine("打印a");
        Console.WriteLine("a的长度{0}",a.Length);
        foreach (byte b in a)
        { Console.WriteLine(b); }
        a = Encoding.UTF8.GetBytes("我爱你");
        Console.WriteLine("给byte赋值");
        Console.WriteLine("a的长度{0}", a.Length);
        foreach (byte b in a)
        {  Console.WriteLine(b); }
        string c;
        c=Encoding.UTF8.GetString(a,0,9);
        Console.WriteLine(c);
    }
}

在这里插入图片描述


http://www.kler.cn/a/132273.html

相关文章:

  • php正则表达式汇总
  • Java实现的插件化策略模式
  • ForkLift:macOS文件管理器/FTP客户端
  • 【全网首发】2023年NOIP真题
  • vue3 + ts项目(无vite)报错记录
  • react-router-dom 版本6.18.0中NavLink的api和属性介绍
  • Redis篇---第六篇
  • 【Linux】常用系统工作命令
  • 大数据架构Lambda-架构师(六十九)
  • [C/C++]数据结构 链表OJ题:随机链表的复制
  • ES6 导入导出
  • redis运维(九)字符串(二)字符串过期时间
  • 为什么C++标准库中atomic shared_ptr不是lockfree实现?
  • 填充每个节点的下一个右侧节点指针
  • wpf devexpress Property Grid创建属性定义
  • Oracle OCP / MySQL OCP认证容易通过吗
  • es 算法函数 有点不太懂了没有大神给指点一下
  • 【2】SM2验签工具和RSA验签工具
  • 【漏洞复现】IP-guard WebServer 远程命令执行
  • element el-date-picker报错Prop being mutated:“placement“快速解决方式