import”@patchwork/contracts/PatchworkUtils/PatchworkUtils.sol”;

Functions


toString8

Converts uint64 raw data to an 8 character string
function toString8(uint64 raw) internal pure returns (string memory out);
Parameters
NameTypeDescription
rawuint64the raw data
Returns
NameTypeDescription
outstringthe string

toString16

Converts uint128 raw data to a 16 character string
function toString16(uint128 raw) internal pure returns (string memory out);
Parameters
NameTypeDescription
rawuint128the raw data
Returns
NameTypeDescription
outstringthe string

toString32

Converts uint256 raw data to a 32 character string
function toString32(uint256 raw) internal pure returns (string memory out);
Parameters
NameTypeDescription
rawuint256the raw data
Returns
NameTypeDescription
outstringthe string

trimUp

Trims a raw string to its null-terminated length
function trimUp(bytes memory byteArray) internal pure returns (string memory out);
Parameters
NameTypeDescription
byteArraybytesthe raw string
Returns
NameTypeDescription
outstringthe trimmed string

convertUint16ToBytes

Converts a uint16 into a 2-byte array
function convertUint16ToBytes(uint16 input) internal pure returns (bytes memory);
Parameters
NameTypeDescription
inputuint16the uint16
Returns
NameTypeDescription
<none>bytesbytes the array

strToUint256

Converts a string to a uint256
function strToUint256(string memory str) internal pure returns (uint256 val);
Parameters
NameTypeDescription
strstringthe string to convert
Returns
NameTypeDescription
valuint256the uint256 value