Vermiculus
Well-known member
{HISTORY}
I am making a basic utility for Native C++ using the .NET framework (hehehe). The idea is to make a window with all the non-standard characters in buttons and have those buttons insert their characters, etc. That's all working perfectly, but C++ needs a hex code or something similar to use the (char)0x-- function. For example, if I wanted to display ┴┴┴┤, i would need to type
With my utility, however, I simply press the button, it displays the stuff the looks nice ☺, and when you hit 'generate code', it generates the code...
The problem lies in this part, understandably enough. Here is what I have so far...
But as long as it took for you to read it, it's take me much longer to go through all 250-some characters. The format for each one is the same, the only difference is the character code. I want to make something a little shorter, a little faster.
So to make an exceptionally long story short, is there any function available to generate the correct hex codes ( or their base-10 equivalents) for a character?
I am making a basic utility for Native C++ using the .NET framework (hehehe). The idea is to make a window with all the non-standard characters in buttons and have those buttons insert their characters, etc. That's all working perfectly, but C++ needs a hex code or something similar to use the (char)0x-- function. For example, if I wanted to display ┴┴┴┤, i would need to type
VB.NET:
cout << (char)0xC1 << (char)0xC1 << (char)0xC1 << (char)0xB4
The problem lies in this part, understandably enough. Here is what I have so far...
VB.NET:
Dim s As String = TextBox1.Text
Dim code As String = "cout << "
For index As Integer = 0 To s.Length - 1
Select Case s.Chars(index)
Case "☺"
MsgBox("Happy!")
code += "(char)0x1 << "
Case "☻"
MsgBox("Sad...")
code += "(char)0x2 << "
Case "♥"
Case "♦"
Case "♣"
Case "♠"
Case "•"
Case "◘"
Case "○"
Case "◙"
Case "♂"
Case "♀"
Case "♪"
Case "♫"
Case "☼"
Case "►"
Case "◄"
Case "↕"
Case "‼"
Case "¶"
Case "§"
Case "▬"
Case "↨"
Case "↑"
Case "↓"
Case "→"
Case "←"
Case "∟"
Case "↔"
Case "▲"
Case "▼"
Case " "
Case "!"
Case """"
Case "#"
Case "$"
Case "%"
Case "&"
Case "''"
Case "("
Case ")"
Case "*"
Case "+"
Case ","
Case "-"
Case "."
Case "/"
Case "0"
Case "1"
Case "2"
Case "3"
Case "4"
Case "5"
Case "6"
Case "7"
Case "8"
Case "9"
Case ":"
Case ";"
Case "<"
Case "="
Case ">"
Case "?"
Case "@"
Case "A"
Case "B"
Case "C"
Case "D"
Case "E"
Case "F"
Case "G"
Case "H"
Case "I"
Case "J"
Case "K"
Case "L"
Case "M"
Case "N"
Case "O"
Case "P"
Case "Q"
Case "R"
Case "S"
Case "T"
Case "U"
Case "V"
Case "W"
Case "X"
Case "Y"
Case "Z"
Case "["
Case "\"
Case "]"
Case "^"
Case "_"
Case "`"
Case "a"
Case "b"
Case "c"
Case "d"
Case "e"
Case "f"
Case "g"
Case "h"
Case "i"
Case "j"
Case "k"
Case "l"
Case "m"
Case "n"
Case "o"
Case "p"
Case "q"
Case "r"
Case "s"
Case "t"
Case "u"
Case "v"
Case "w"
Case "x"
Case "y"
Case "z"
Case "{"
Case "|"
Case "}"
Case "~"
Case "⌂"
Case "Ç"
Case "ü"
Case "é"
Case "â"
Case "ä"
Case "à"
Case "å"
Case "ç"
Case "ê"
Case "ë"
Case "è"
Case "ï"
Case "î"
Case "ì"
Case "Ä"
Case "Å"
Case "É"
Case "æ"
Case "Æ"
Case "ô"
Case "ö"
Case "ò"
Case "û"
Case "ù"
Case "ÿ"
Case "Ö"
Case "Ü"
Case "¢"
Case "£"
Case "¥"
Case "₧"
Case "ƒ"
Case "á"
Case "í"
Case "ó"
Case "ú"
Case "ñ"
Case "Ñ"
Case "ª"
Case "º"
Case "¿"
Case "⌐"
Case "¬"
Case "½"
Case "¼"
Case "¡"
Case "«"
Case "»"
Case "░" ' these are what I really need,
Case "▒" ' but I have to accommodate for
Case "▓" ' all possibilities
Case "│"
Case "┤"
Case "╡"
Case "╢"
Case "╖"
Case "╕"
Case "╣"
Case "║"
Case "╗"
Case "╝"
Case "╜"
Case "╛"
Case "┐"
Case "└"
Case "┴"
Case "┬"
Case "├"
Case "─"
Case "┼"
Case "╞"
Case "╟"
Case "╚"
Case "╔"
Case "╩"
Case "╦"
Case "╠"
Case "═"
Case "╬"
Case "╧"
Case "╨"
Case "╤"
Case "╥"
Case "╙"
Case "╘"
Case "╒"
Case "╓"
Case "╫"
Case "╪"
Case "┘"
Case "┌"
Case "█"
Case "▄"
Case "▌"
Case "▐"
Case "▀"
Case "α"
Case "ß"
Case "Γ"
Case "π"
Case "Σ"
Case "σ"
Case "µ"
Case "τ"
Case "Φ"
Case "Θ"
Case "Ω"
Case "δ"
Case "∞"
Case "φ"
Case "ε"
Case "∩"
Case "≡"
Case "±"
Case "≥"
Case "≤"
Case "⌠"
Case "⌡"
Case "÷"
Case "≈"
Case "°"
Case "∙"
Case "•"
Case "√"
Case "ⁿ"
Case "²"
Case "■"
Case " "
End Select
Next
So to make an exceptionally long story short, is there any function available to generate the correct hex codes ( or their base-10 equivalents) for a character?
Last edited: