How can I get characters code?
Hello,
I am trying to concat two strings at runtime and between them I want to insert a special character that I found in charmap in windows.
There are many characters and their code is written in the down-left corner of the window.
For example if I want to insert the diameter (Ø) character in a string that has U+00D8 how do I make this at runtime.
Also I will have to check if this character exists or not in a textbox. (If textBox1.Text.Contains(......code???......) Then...)
Thx.
Re: How can I get characters code?
The U+00D8 means a Unicode value of D8 in hexadecimal, which is 216 in decimal. The Convert.ToChar method will create a Char from an Integer containing its Unicode value, e.g.
Code:
Dim ch = Convert.ToChar(&HD8)
You can then concatenate a Char with a String exactly as you would another String.
Re: How can I get characters code?
Thank you. I got it.
Cheers
Re: How can I get characters code?
Since it sounds like you may use this character often, you may consider creating a static variable so that wherever you you it, you can just use the static variable instead of having to keep using Covert.ToChar() function all over the place.
Re: How can I get characters code?
Is there any reason why Chr(&HD8) isn't adequate here?