solidity/test/libsolidity/semanticTests/literalSuffixes/suffixed_bytes.sol
2023-05-17 16:55:14 +02:00

32 lines
680 B
Solidity

function length(bytes memory value) pure suffix returns (uint) {
return value.length;
}
contract C {
function empty() public pure returns (uint) {
return "" length;
}
function short() public pure returns (uint) {
return 'abcd' length;
}
function long() public pure returns (uint) {
return 'abcdefghijklmnop abcdefghijklmnop' length;
}
function hex_() public pure returns (uint) {
return hex'0123456789abcdef' length;
}
function unicode_() public pure returns (uint) {
return unicode"😃" length;
}
}
// ----
// empty() -> 0
// short() -> 4
// long() -> 33
// hex_() -> 8
// unicode_() -> 4