如何在VB.NET中将字符串转换为十六进制? [英] How do you convert a string into hexadecimal in VB.NET?
本文介绍了如何在VB.NET中将字符串转换为十六进制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将文本框中的字符串转换为十六进制?
How do I convert a string from a textbox into hexadecimal?
我只在 C# 中找到了方法.VB.NET 有能力做这样的事情吗?如果可以,那么我想知道如何将字符串转换为十六进制和十六进制转换为字符串.
I have only found ways in C#. Does VB.NET have the ability to do such a thing? If it can then I'd like to know how to convert string to hex and hex to string.
推荐答案
Dim val As String
val = "10"
Dim hexVal As Integer
hexVal = Convert.ToInt32(val, 16) //16 specifies the base
Console.WriteLine(hexVal)
这将显示 16,它是十六进制字符串10"的等效整数.
This will display 16 which is the integer equivalent of the hexadecimal string "10".
这篇关于如何在VB.NET中将字符串转换为十六进制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文