数组使用

Dim arr(16)
arr(0) = "0"
arr(1) = "1"
arr(2) = "2"
arr(3) = "3"
arr(4) = "4"
arr(5) = "5"

通过字符串分割成数组

//定义一个字符串
Dim 我是字符串="1,2,3,4,5,6,7,8,9"
//分割字符串 
Dim 分割=split(我是字符串,",")
//获取下标 UBound
TracePrint UBound(分割)
//当前脚本第7行:8
//然后我们来遍历他
For i = 0 To UBOUND(分割)
TracePrint 分割(i)    //就得到了字符串的每个元素
Next

获取数组长度

取余数
num mod 16

声明函数

Function StrHex(num)
Dim arr(16)
Dim len
Dim retext
Dim numchar
Dim n
arr(0) = "0"
arr(1) = "1"
arr(2) = "2"
arr(3) = "3"
arr(4) = "4"
arr(5) = "5"
arr(6) = "6"
arr(7) = "7"
arr(8) = "8"
arr(9) = "9"
arr(10) = "A"
arr(11) = "B"
arr(12) = "C"
arr(13) = "D"
arr(14) = "E"
arr(15) = "F"
len = 0
retext = ""

//  MessageBox(arr(0))
    If num >= 4096 Then 
        len = 4
    ElseIf num >= 256 Then
        len = 3
    ElseIf num >= 16 Then
        len = 2
    ElseIf num >= 0 Then
        len = 1
    End If
    For n = 0 To len-1
        numchar = num mod 16
        TracePrint(arr(numchar))
        num = num / 16
        retext =  arr(numchar) & retext
    Next
    StrHex = retext

End Function

如何连接字符串
http://bbs.anjian.com/showtopic-510513-1.aspx

变量类型哦转换
a = CStr(b)
a = int(b)
http://www.doc88.com/p-9791508616114.html

视频教程
https://www.iqiyi.com/playlist297017402.html

发表评论

电子邮件地址不会被公开。 必填项已用*标注