我需要十六进制转换为 VB.NET 的小数。发现在C#中的几个例子,但是当我试图转换到VB.NET我没有成功。那我想转换为十六进制数的一个例子是A14152464C203230304232323020572F544947455234352E。
I need to convert hex to a decimal in VB.NET. Found several examples in C#, but when I tried to convert to VB.NET I was not successful. An example of a hexadecimal number that I am trying to convert is "A14152464C203230304232323020572F544947455234352E".
推荐答案这是一个24字节(192位)数;你期待什么样的价值?
That is a 24-byte (192-bit) number; what value are you expecting?
请注意,您可以使用转换做了很多蹩脚的工作,在这里 - 例如(在C#):
Note that you can use Convert to do a lot of the grungy work here - for example (in C#):
string hex = "A14152464C203230304232323020572F544947455234352E"; byte[] raw = new byte[hex.Length / 2]; for (int i = 0; i < raw.Length ; i++) { raw[i] = Convert.ToByte(hex.Substring(i * 2,2), 16); }
你如何从获得原来一个数量取决于你怎么想的号码是...
How you get from raw to a number depends on what you think the number is...
Visual Basic中的翻译礼貌 反射的(虽然-1看起来很奇怪):
Visual Basic translation courtesy of .NET Reflector (although the "-1" looks odd):
Dim hex As String = "A14152464C203230304232323020572F544947455234352E" Dim raw As Byte() = New Byte((hex.Length / 2) - 1) {} Dim i As Integer For i = 0 To raw.Length - 1 raw(i) = Convert.ToByte(hex.Substring((i * 2), 2), &H10) Next i更多推荐
你如何转换成十六进制使用VB.NET为十进制?
发布评论