十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
'''这个函数功能就是用来把数组转为string的格式'''如byte()={1,2,3,4,5,6}转化后变为",1,2,3,4,5,6,"Function ByteArrayToString(bytes() As Byte) As String Dim s As String = "" For i As Integer = 0 To bytes.Length s = Convert.ToString(bytes(i)) "," Next Return “," sEnd Function Sub Search()Dim a as byte()={1,2,3,4,5,6}
让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:主机域名、网站空间、营销软件、网站建设、长安网站维护、网站推广。
Dim b as byte()={2,3,4}
Dim astr As String = ByteArrayToString(a)Dim bstr As String = ByteArrayToString(b)Dim index As Integer = astr.IndexOf(bstr) '这个index就是b数组在a数组的位置,下标从0开始,不过记得处理下逗号,因为这时候是字符串。'''如果index小于0说明没有匹配内容End Sub 现在说明下ByteArrayToString为什么要在字符串开头加个",",如果不加,可能出现a="1,23,4,5,6,", b="3,4,5,",结果导致查询位置错误,匹配了a的位置
先遍历数组:
for i = 0 to Ubound(数组)
...
next
再把中间的...替换成:
if 数组(i) = 特定的字符 then msgbox "找到鸟,当前是:数组" i
Sub 和()
Dim Arr, Dic As Object, i, j, k
Set Dic = CreateObject("Scripting.Dictionary")
Arr = Array(5, 7, 11, 13, 17, 19)
For i = 0 To UBound(Arr)
For j = 0 To UBound(Arr)
For k = 0 To UBound(Arr)
Dic(Arr(i) + Arr(j) + Arr(k)) = ""
Next k
Next j
Next i
MsgBox Dic.Count
Set Dic = Nothing
End Sub
结果为22种不同的和值。