C# Byte[] 数组操作

byte[] Strbyte = Encoding.GetEncoding("big5").GetBytes(str);
            if (Strbyte.Length < len)
            {
                Strbyte = Encoding.GetEncoding("big5").GetBytes(str.PadRight(len, ' '));
            }
            Byte[] ThisByte = new Byte[len];
            if (Strbyte.Length > len)
            {
                Buffer.BlockCopy(Strbyte, 0, ThisByte, 0, len);
            }
            else
            {
                
                Buffer.BlockCopy(Strbyte, 0, ThisByte, 0, Strbyte.Length);
            }
            return Encoding.GetEncoding("big5").GetString(ThisByte);

原文地址:https://www.cnblogs.com/LuoEast/p/8298256.html