solidity 中字符串怎么相加

ANYFC ANYFC 提出于 2021-11-21 14:37 4535 浏览

solidity 中有没有 类似 str1 + str2 这样的方法

最佳答案

2021-11-21 16:06
pragma solidity >=0.7.1;

contract C {
    function concatenate(string memory s1, string memory s2) public pure returns (string memory) {
        return string(abi.encodePacked(s1, s2));
    }
}
Tiny熊

擅长:智能合约,以太坊 · 采纳率 33% · 回答于 2021-11-21 14:54

其它 0 个回答

写回答

你需要登录后才可以回答问题,登录