Open aurelienchev opened 1 year ago
on version 0.8, the function for conversion uint -> string is not working.
update potential: function uint2str(uint _i) internal pure returns (string memory str) { if (_i == 0){ return "0"; } uint256 j = _i; uint256 length; while (j != 0){ length++; j /= 10; } bytes memory bstr = new bytes(length); uint256 k = length; j = _i; while (j != 0) { bstr[--k] = bytes1(uint8(48 + j % 10)); j /= 10; } str = string(bstr); }
on version 0.8, the function for conversion uint -> string is not working.
update potential: function uint2str(uint _i) internal pure returns (string memory str) { if (_i == 0){ return "0"; } uint256 j = _i; uint256 length; while (j != 0){ length++; j /= 10; } bytes memory bstr = new bytes(length); uint256 k = length; j = _i; while (j != 0) { bstr[--k] = bytes1(uint8(48 + j % 10)); j /= 10; } str = string(bstr); }