1
contract TypeConversion{

    uint96 data = 5;
    bytes32 b = bytes32(data);

}

It gives error:
Explicit type conversion not allowed from "uint96" to "bytes32".

What will be the better way to convert integers to a string in solidity?

2
  • What is uint95? Feb 3, 2020 at 8:06
  • What will be the better way to convert integers to a string in solidity? - that is a different question than the question in the title. Feb 3, 2020 at 8:08

1 Answer 1

2

Try this:

bytes32 b = bytes32(uint256(data));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.