Created
July 10, 2019 17:29
-
-
Save andreafspeziale/1ad376d489d909546e6b3536467ace6f to your computer and use it in GitHub Desktop.
Solidity function which concatenates the bytes array items
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @dev Returns primitive bytes type from an array of bytes. | |
* @param items The bytes array. | |
*/ | |
function concatBytes(bytes[] memory items) | |
private | |
pure | |
returns(bytes memory) | |
{ | |
bytes memory data = items[0]; | |
for (uint i = 1; i < items.length; i++) { | |
data = abi.encodePacked(data, items[i]); | |
} | |
return data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment