pragma solidity ^0.8.0;
contract My {
event log(uint256 a);
event log(string a);
string name = unicode"小米";
string name_b = "bbbb";
function forTest(uint256 b) public returns (uint256) {
require(b == 100);
uint256 a = 0;
emit log(a);
for (uint256 x = 1; x <= b; x++) {
a = a + x;
}
emit log(a);
return a;
}
function StrTest() public view returns (string memory,uint256) {
return (string(abi.encodePacked(name, "+", name_b)), bytes(name_b).length);
}
}