In solidity, I can take advantage of the hex literal in order to get back the corresponding hex value of a string, in the following way:


I am wondering how to apply such literal on a variable. Let's say my hex string is a constant hexValue.

How can I apply the literal on hexValue?

Thanks for the help

  • It is not clear what you are trying to achieve, can you write some code to explain the idea?
    – Ismael
    Apr 1, 2021 at 0:50
  • Consider a variable string memory value = "001122FF". How can I apply the hex literal on the variable value? Apr 1, 2021 at 10:55


Browse other questions tagged or ask your own question.