0

My use case is, I need to concat address with string this way, "ab" + sp.self_address + "cd" . How to achieve this in smartpy ?

1
  • Apologies for the duplicate, I thought it was easy to convert an address to bytes, and there was a sample in that link of concatenating bytes to a string. Seems i'm mistaken as there are unanswered questions around this topic. I've reopened the question
    – Simon McLoughlin
    Mar 29, 2023 at 15:11

1 Answer 1

0

You cannot concatenate address to string without converting address to string and for that see https://tezos.stackexchange.com/a/2894/5292

Can you explain in detail your use case ?

Most of the time, when people ask this question, there is a better way to design their smart contract and client interfaces.

The conversion should be done on the client side or not at all. In the second case, you may use a sp.record as a replacement (for example for an error message).

Notice that this question is different from.

How to create a lambda f such as f(a) = s where a is an address and s the unique string computed from a.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.