Is there a simple way to convert bytes32
to bytes
in Solidity?
I'm trying to get the length of the string passed in the bytes32 variable but everything gets returned 32 size which makes sense.
But explicit conversion does not seem to work:
bytes memory _tmpUsername = bytes(_username); // _username is of type bytes32
This throws an error of:
Explicit type conversion not allowed from "bytes32" to "bytes storage pointer"