简体   繁体   中英

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

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 "

is it possible i don't want spaces in the above converted decimal ?

vb.net help please

Okay here i tried and got it n is my approach works fine will this fine n work always right

 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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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