简体   繁体   English

在vb.net中将大字符串转换为十进制

[英]Convert big string to decimal in vb.net

Hello i have big string value which is md5 of something now i need to convert it into the decimal value 您好,我有一个很大的字符串值,它是md5,现在我需要将其转换为十进制值

for example 例如

Dim md5_s As String = "6F05AF42533432A5513610FE839ACC86"

now i need output same like the online converters to this 现在我需要像在线转换器一样的输出

"54 70 48 53 65 70 52 50 53 51 51 52 51 50 65 53 53 49 51 54 49 48 70 69 56 51 57 65 67 67 56 54 " “ 54 70 48 53 65 70 52 50 53 51 51 52 51 50 65 53 53 49 51 54 49 48 70 69 56 51 57 65 67 67 56 54”

is it possible i don't want spaces in the above converted decimal ? 我是否可以在上面转换的十进制中不要空格?

vb.net help please vb.net请帮助

Okay here i tried and got it n is my approach works fine will this fine n work always right 好吧,我在这里尝试并得到它n是我的方法可以正常工作吗?

 Dim t As String
        Dim a As String = "6F05AF42533432A5513610FE839ACC86"
        For Each c As Char In a
            t &= Convert.ToInt32(c)
        Next

        TextBox1.Text = t

will this one is right ? 请问这是对的吗?

result is same what i am looking for as 结果是我想要的一样

5470485365705250535151525150655353495154494870695651576567675654 5470485365705250535151525150655353495154494870695651576567675654

so i assume this is right huh ? 所以我认为这是对吧?

I'm not quite sure this is what you are really looking for but this is what you asked for 我不太确定这是您真正要寻找的东西,但这是您要的东西

  For count = 0 To md5_s.Length - 1
        Dim tempChar As String = md5_s.Substring(count, 1)
        Console.Write(Asc(tempChar))
    Next

What is more likely what you want is something like this 你可能想要的是这样的东西

 Private Function HexToByteArray(ByVal hex As [String]) As Byte()
    Dim NumberChars As Integer = hex.Length
    Dim bytes As Byte() = New Byte(NumberChars / 2 - 1) {}
    For i As Integer = 0 To NumberChars - 1 Step 2
        bytes(i / 2) = Convert.ToByte(hex.Substring(i, 2), 16)
    Next
    Return bytes
End Function

either way ... hope this helps 无论哪种方式...希望这会有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM