I'm trying to concatenate two strings in solidity.
I tried with +
or .
but neither option works. There is not much documentation on string concatenation yet. Is it even possible?
If not, can I insert variables into strings?
contract-developmentsoliditystring
I'm trying to concatenate two strings in solidity.
I tried with +
or .
but neither option works. There is not much documentation on string concatenation yet. Is it even possible?
If not, can I insert variables into strings?
Best Answer
As of Feb 2022, in Solidity
v0.8.12
you can now concatenate strings in a simpler fashion!Taken directly from the solidity docs on strings and bytes:
The above code snippet is provided by Hannu-Daniel Goiss on his article about string concatenation.