惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
罗磊的独立博客
人人都是产品经理
人人都是产品经理
博客园_首页
Hugging Face - Blog
Hugging Face - Blog
美团技术团队
L
Lohrmann on Cybersecurity
博客园 - 【当耐特】
量子位
Last Week in AI
Last Week in AI
D
Darknet – Hacking Tools, Hacker News & Cyber Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
C
Cyber Attacks, Cyber Crime and Cyber Security
腾讯CDC
有赞技术团队
有赞技术团队
Cyberwarzone
Cyberwarzone
T
Tor Project blog
V
V2EX
L
LINUX DO - 热门话题
Security Latest
Security Latest
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
NISL@THU
NISL@THU
C
Cisco Blogs
T
Tailwind CSS Blog
G
GRAHAM CLULEY
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
小众软件
小众软件
K
Kaspersky official blog
博客园 - 司徒正美
IT之家
IT之家
大猫的无限游戏
大猫的无限游戏
Jina AI
Jina AI
S
Schneier on Security
月光博客
月光博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
The Exploit Database - CXSecurity.com
Scott Helme
Scott Helme
J
Java Code Geeks
博客园 - 聂微东
Martin Fowler
Martin Fowler
MongoDB | Blog
MongoDB | Blog
AWS News Blog
AWS News Blog
Know Your Adversary
Know Your Adversary
C
Cybersecurity and Infrastructure Security Agency CISA
F
Fortinet All Blogs
T
Threat Research - Cisco Blogs
C
CXSECURITY Database RSS Feed - CXSecurity.com
雷峰网
雷峰网

博客园 - 撬棍

【.Net】执行CMD命令 【.Net】获取随机数函数 【.Net】注册程序开机启动 【.Net】把窗体“钉”到桌面上 【.Net】多语言查看MSDN 【.Net】 显示星期字符串 【.Net】 判断时间字符串正确性 【.Net】 实现窗口拖动 【.Net】 Winform 单例运行实例 [C++]函数返回值 [C++]数组参数 [C++]const的指针使用 [C++]指针类型出参 [VBA]Excel输出utf-8编码格式文件 使用WideCharToMultiByte 【C++】split [C语言学习]之打印万年历 - 撬棍 - 博客园 [VB6.0]让程序在任务列表和资源管理器“隐身” [InstallShield]FindAllFiles与SetFileInfo配合实现文件加多文件属性设置 [VB]修改注册表让程序开机自动运行 - 撬棍 - 博客园
【.Net】2、8、16进制转换
撬棍 · 2013-09-23 · via 博客园 - 撬棍
    Private Function Asc2String(ByVal str As String) As String
        Dim StrDesc As System.String = String.Empty
        If str = String.Empty OrElse str.Length Mod 2 <> 0 Then
            MessageBox.Show("Input string error.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            Asc2String = String.Empty
            Exit Function
        End If
        For i As System.Int32 = 0 To str.Length() - 1 Step 2
            Dim s As System.String = Mid(str, i + 1, 2)
            Dim num As System.Int32 = Convert.ToInt32(s, 16)
            If num < 0 OrElse num > 256 Then
                MessageBox.Show(String.Format("Input number {0} error.", num.ToString()), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
                Asc2String = String.Empty
                Exit Function
            End If
            StrDesc = StrDesc & ChrW(num)
        Next
        Asc2String = StrDesc.Trim
    End Function

Public Shared Function ToInt32(ByVal value As String, ByVal fromBase As Integer) As Integer

成员属于: System.Convert
摘要:
将指定基数的数字的 System.String 表示形式转换为等效的 32 位有符号整数。

参数:
value: 包含数字的 System.String。
fromBase: value 中数字的基数,它必须是 2、8、10 或 16。

返回值:
等效于 value 中的数字的 32 位有符号整数。 - 或 - 如果 value 为 null,则为零。

异常:
System.ArgumentException: fromBase 不是 2、8、10 或 16。 - 或 - value,它表示一个非 10 为基的有符号数,前面带一个负号。
System.FormatException: value 包含的一个字符不是 fromBase 指定的基中的有效数字。如果 value 中的第一个字符无效,异常消息则指示没有可转换的数字;否则,该消息将指示 value 包含无效的尾随字符。
System.OverflowException: value,它表示一个非 10 为基的有符号数,前面带一个负号。 - 或 - 返回值小于 System.Int32.MinValue 或大于 System.Int32.MaxValue。

    Private Function String2Asc(ByVal str As String) As String
        Dim StrDesc As System.String = String.Empty
        For i As System.Int32 = 0 To str.Length() - 1
            Dim s As System.Char = str(i)
            StrDesc = StrDesc & Convert.ToString(AscW(s), 16)
        Next
    End Function

Public Shared Function ToString(ByVal value As Integer, ByVal toBase As Integer) As String
成员属于: System.Convert
摘要:
将 32 位有符号整数的值以指定的基数转换为它的等效 System.String 表示形式。

参数:
value: 32 位有符号整数。
toBase: 返回值的基数,必须是 2、8、10 或 16。

返回值:
以 toBase 为基数的 value 的 System.String 表示形式。

异常:
System.ArgumentException: toBase 不是 2、8、10 或 16。