I want to generate a 4 character hex number.
To generate a hex number you can use
string.format("{0:X}", number)
and to generate a 4 char string you can use
string.format("{0:0000}", number)
Is there any way to combine them?
I'm assuming you mean: 4-digit hexadecimal number.
If so, then yes:
string.Format("{0:X4}", number)
should do the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With