【发布时间】:2018-07-13 23:56:18
【问题描述】:
大家好,这是我的代码,我想用solidity反转一个字符串:
function reverseValue(string _base) internal returns(string){
bytes memory _baseBytes = bytes(_base);
string memory _tempValue = new string(_baseBytes.length);
bytes memory _newValue = bytes(_tempValue);
for(uint i=_baseBytes.length;i<=0;i--){
_newValue[_baseBytes.length - i] = _baseBytes[i];
}
return string(_newValue);
}
但唯一的结果是下面的代码:
0:string : \u0000\u0000\u0000\u0000\u0000\u0000
我认为我的代码写对了,但我找不到问题... tnx 来帮助我:)
【问题讨论】:
标签: solidity