Created
April 30, 2019 03:43
-
-
Save bitcoinbrisbane/d4ec149e6f2101183406cfb3f381dc90 to your computer and use it in GitHub Desktop.
This file contains 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
// Concate string | |
function strConcat(string _a, string _b, string _c) internal pure returns (string) { | |
bytes memory _ba = bytes(_a); | |
bytes memory _bb = bytes(_b); | |
bytes memory _bc = bytes(_c); | |
string memory abcde = new string(_ba.length + _bb.length + _bc.length); | |
bytes memory babcde = bytes(abcde); | |
uint k = 0; | |
for (uint i = 0; i < _ba.length; i++) { | |
babcde[k++] = _ba[i]; | |
} | |
for (i = 0; i < _bb.length; i++) { | |
babcde[k++] = _bb[i]; | |
} | |
for (i = 0; i < _bc.length; i++) { | |
babcde[k++] = _bc[i]; | |
} | |
return string(babcde); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment