Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. function concat(string memory _base, string memory _value) internal pure returns (string memory) {
  2. bytes memory _baseBytes = bytes(_base);
  3. bytes memory _valueBytes = bytes(_value);
  4.  
  5. string memory _tmpValue = new string(_baseBytes.length + _valueBytes.length);
  6. bytes memory _newValue = bytes(_tmpValue);
  7.  
  8. uint i;
  9. uint j;
  10.  
  11. for(i=0; i<_baseBytes.length; i++) {
  12. _newValue[j++] = _baseBytes[i];
  13. }
  14.  
  15. for(i=0; i<_valueBytes.length; i++) {
  16. _newValue[j++] = _valueBytes[i];
  17. }
  18.  
  19. return string(_newValue);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement