Question in the title, how to concatenate 2 strings in Solidity?
Googled and searched here but no luck.
Please help, Thanks
Question in the title, how to concatenate 2 strings in Solidity?
Googled and searched here but no luck.
Please help, Thanks
With solidity 0.8.12 you can just do string.concat like so:
function strConcat(string memory one, string memory two) external returns(string memory) {
return string.concat(one, two);
}
Also, see this: How to concatenate strings in solidity?
Hope this helps!
strings can concatenated by
abi.encodePacked(firstString, secondString)
ERC721 uses above concatenation method.
function strConcat(string calldata firstString, string calldata secondString) external pure returns (string memory) {
return string(abi.encodePacked(firstString, secondString));
}