Reputation: 1876
How can I get the unicode values (from the code
column) if I have the string?
For example, for passing the empty space " " I would like to get the value U+0020
.
I found this approach:
byte[] asciiBytes1 = Encoding.ASCII.GetBytes(" ");
But this returns me the value from the decimal
column.
Upvotes: 0
Views: 489
Reputation: 3676
If value
is your decimal value:
string code = $"U+{value.ToString ("X4")}";
will give you what you want.
(X means hex, 4 means pad to 4 digits)
Upvotes: 2