Hi, guys! How can I generate a string that depends on a variable of type int in Func? For example: "My value is {x}".

Oct 8, 2022, 8:33 PM
Usually strings are stored in slice structure as ASCII chars, so just put your value in the slice, if you want to store an integer, you should convert it in ASCII chars before storing. Btw " " doesn't exist onchain, you can use it only while coding your contract, it converts to slice automatically
Oct 8, 2022, 9:24 PM
Okay, thanks! I thought about this approach, but I hoped there was an easier way.
Oct 8, 2022, 9:33 PM

© 2024 Draquery.com All rights reserved.