Vb.net Hex Translator麻烦 [英] Vb.net Hex Translator trouble

查看:119
本文介绍了Vb.net Hex Translator麻烦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,所以我正在开展一个项目,我必须将十六进制转换为数字和英文字母。

我能想到这样做的唯一方法是使用Case并返回..然而,似乎案件不会超过一个角色...



如果有人知道我如何能够实现一个十六进制到英语的翻译,请帮助我。

谢谢:)



以下是应该控制翻译的内容。

以下工作正常如果我只是放ex中有一个字符:大小写为0,但我需要大小写才能容纳2个字符,因为这就是hex的含义。案例AE



Ok so I'm working on a project in which I have to covert hex into numbers and english letters.
The only way I could think of doing this was by using Case and return.. However It seems case won't take more than one character...

If anyone knows how I can achieve a hex to english translator please help me.
Thanks :)

Below is what should control the translation.
It following works fine if I were to just put one character into ex: Case "0" but I need case to hold 2 characters because that's what hex is. case "AE"

Private Sub Clicked_On_myButton(ByVal sender As Object, ByVal e As System.EventArgs)
        For Each alpha As Char In mytextbox1.Text
            mytextbox2.Text &= HextoEnglish(CStr(alpha))
        Next
    End Sub
    Public Function HextoEnglish(English) As String
        Select Case English

            Case "01"
                Return "À"
            Case "02"
                Return "Á"
            Case "03"
                Return "Â"
            Case "04"
                Return "Ç"
            Case "05"
                Return "È"
            Case "06"
                Return "É"
            Case "07"
                Return "Ê"
            Case "08"
                Return "Ë"
            Case "09"
                Return "Ì"
            Case "0B"
                Return "Î"
            Case "0C"
                Return "Ï"
            Case "0D"
                Return "Ò"
            Case "0E"
                Return "Ó"
            Case "0F"
                Return "Ô"
            Case "10"
                Return "Œ"

            Case Else
        End Select
    End Function
End Class

推荐答案

你真的有很多需要学习的东西。为什么不将这些字符放入一个数组中然后只使用十六进制值(顺便说一下这个数字!)作为数组的索引来检索值代表的字符??
You really do have a lot to learn. Why not put these characters into an array and then just use the hex value (which is just a number by the way!) as an index into the array to retrieve the character that value represents??


这篇关于Vb.net Hex Translator麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆