你如何转换成十六进制使用VB.NET为十进制?

编程入门 行业动态 更新时间:2024-10-18 14:21:04
本文介绍了你如何转换成十六进制使用VB.NET为十进制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我需要十六进制转换为 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为十进制?

本文发布于:2023-10-24 20:05:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1524875.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:转换成   十六进制   VB   NET   十进制

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!