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

27 lines
572 B
Solidity

function length(string memory value) pure suffix returns (uint) {
return bytes(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 unicode_() public pure returns (uint) {
return unicode"😃" length;
}
}
// ----
// empty() -> 0
// short() -> 4
// long() -> 33
// unicode_() -> 4