solidity智能合约[12]-固定字节数组相互转换
2018-11-19 智能合约 solidity语法 solidity, 以太坊, 智能合约 7 评论 字数统计: 79(字) 阅读时长: 1(分)
固定字节数组相互转换
固定长度字节数组之间能够进行相互转换
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协议 许可协议。转载请注明出处!
郑建勋(jonson)区块链工程师 & Web工程师
灾难总是接踵而至,这正是世间的常理。你以为只要哭诉一下,就会有谁来救你吗?如果失败了,就只能说明我不过是如此程度的男人。