My code for concatenating 2 strings is pretty simple:
string baseUrl = "http://localhost:8080/";
string url = baseUrl.append(url_secret);
But I have got an error:
Error: Different number of components on the left hand side (1) than on the right hand side (0).
--> test.sol:156:9:
|
156 | string url = baseUrl.append(url_secret);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
What is wrong?
The
.append()function modifies the existing string, so nothing is returned.So you can just call
and then
baseUrlwill be modified. If you want to set a new variableurlwith the new value, you can do