How can I parse an integer (uint) to a string in solidity?
This is what I have attempted to do so far:
function bytes32ToString (bytes32 data) returns (string) {
bytes memory bytesString = new bytes(32);
for (uint j=0; j<32; j++) {
byte char = byte(bytes32(uint(data) * 2 ** (8 * j)));
if (char != 0) {
bytesString[j] = char;
}
}
return string(bytesString);
}
But the following line returns an error:
string myString= bytes32ToString(bytes32(myInteger));
Type string memory is not implicitly convertible to expected type string storage pointer.
Why is this?