Created
August 2, 2022 23:04
-
-
Save casweeney/22a316c13c8a2380da55685c9f226a31 to your computer and use it in GitHub Desktop.
Contract to typecast bytes32 to string
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
contract TypeCasting { | |
bytes32 public x = "This is the beginning of Adddddd"; | |
string public y = "This is the beginning of Adddddd"; | |
function convertByteToString() public view returns(string memory) { | |
string memory result = string(abi.encodePacked(x)); | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment