0

I was wondering if it is possible to convert a bytes32 to a string in solidity like this, I want an input bytes32 input = 0x74657374 and an output of string output = "0x74657374"

BlockchainBoy
  • 345
  • 1
  • 4
  • 10

1 Answers1

0

Yes, but you wouldn't want to do that normally.

Generally, don't burden a contract with a client's job. It isn't especially easy to do because bytes and string are variable length and therefore require setting aside a word for length. The length of bytes32 requires no such extra internal organization.

Have a look over here: How to convert bytes32 to string?

Hope it helps.

Rob Hitchens
  • 55,151
  • 11
  • 89
  • 145