不明白这个为什么会一致报错 报错内容
dynamicString.sol:27:22: DeclarationError: Undeclared identifier. Did you mean "name", "name3" or "nmae2"? return bytes(name2).length; ^---^
具体代码
pragma solidity ^0.4.26;
contract DynamicString{
string name3 = "字节字节";
string nmae2 = "#$%^&*%%%";
string name = "eleven"; // 0x656c6576656e
function getChineseName() view returns(bytes){
return bytes(name3);
}
function getLength3() view returns(uint){
// return name.length;
return bytes(name3).length;
}
function getLength2() view returns(uint){
// return name.length;
return bytes(name2).length;
}
function getLength() view returns(uint){
// return name.length;
return bytes(name).length;
}
function changeName() view returns(bytes1){
// return name[0];
return bytes(name)[0];
}
function getName() view returns(bytes){
return bytes(name);
}
function changeName4() {
// return name[0];
bytes(name)[1] = "Q";
}
}