您的位置:首页 > 其它

as3 ByteArray和.NET 中Byte[] 字节数组的转化

2013-04-01 14:01 435 查看
C# 代码有这么一段:

byte[] bText = System.Text.Encoding.GetEncoding("gb2312").GetBytes(txtMsgValue.Text.Trim());
string bbText = BitConverter.ToString(bText).Replace("-", "");


AS3 改写:

var bytes:ByteArray =new ByteArray();
bytes.writeMultiByte(txtMsgValue.text,"gb2312");
bytes.position=0;
var bbText:String ="";
while(bytes.bytesAvailable)
{
bbText+=bytes.readUnsignedByte().toString(16);
}
bbText=bbText.replace(/-/g,"");//
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐