Skip to content

Instantly share code, notes, and snippets.

@rosdec
Last active September 23, 2020 20:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rosdec/a58b069248c80608030a8f26444c7500 to your computer and use it in GitHub Desktop.
Save rosdec/a58b069248c80608030a8f26444c7500 to your computer and use it in GitHub Desktop.
pragma solidity ^0.7.1;
contract C {
function compare(string memory s1, string memory s2) public pure returns (bool) {
return keccak256(abi.encodePacked(s1)) == keccak256(abi.encodePacked(s2));
}
function concatenate(string memory s1, string memory s2) public pure returns (string memory) {
return string(abi.encodePacked(s1, s2));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment