solidity智能合约[12]-固定字节数组相互转换
固定长度字节数组之间能够进行相互转换
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
pragma solidity ^0.4.23;
contract fixTofix{
bytes6 name = 0x6a6f6e736f6e;
//bytes1: 0x6a
function Tobytes1() view public returns(bytes1){
return bytes1(name);
}
//bytes2: 0x6a6f
function Tobytes2() view public returns(bytes2){
return bytes2(name);
}
// bytes8: 0x6a6f6e736f6e0000
function Tobytes3() view public returns(bytes8){
return bytes8(name);
}
}
本文链接:https://dreamerjonson.com/2018/11/19/solidity-12-fixByteConvertion/
版权声明:本博客所有文章除特别声明外,均采用CC BY 4.0 CN协议许可协议。转载请注明出处!
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。