vb.net去除重复值 vba 大量 去重复 速度最快

VB.Net去除数组中重复的字符的元素?比如数组a 。里面有5个值 , 其中有3个是重复的?
如果这样的话,很好办哦 。
新建一个数组b,然后遍历要去除的数组a,
从a中把每一个都取出来,和新建的b里面的去比,如果有相同的,则不放入b,
否则就放入数组b,直到循环结束 。
vb.net去掉重复数组怎么做?Dim array1() As String
Dim array2() As Boolean
Dim i As Integer
Dim j As Integer
Dim str1 As String = "a,c,c,c,a,b,c,d,f,eee,eee"
array1 = Split(str1, ",")
str1 = ""
ReDim array2(UBound(array1))
For i = 0 To UBound(array1)
array2(i) = False
Next
For i = 0 To UBound(array1) - 1
If array2(i) = False Then
For j = i + 1 To UBound(array1)
If array1(i) = array1(j) And array2(j) = False Then
array2(j) = True
End If
Next j
End If
Next i
For i = 0 To UBound(array1)
If array2(i) = False Then
str1 = str1array1(i)","
End If
Next i
If str1"" Then
str1 = Strings.Left(str1, Len(str1) - 1)
End If
VB中如何删除数组变量中重复的元素?Private Function NewArray(ByRef b() As Integer)
Dim Temp() As Integer
Dim H As Integer, I As Integer, J As Integer, K As Integer
Dim IsNew As Boolean
H = UBound(b())
ReDim Temp(0) '如果vb.net去除重复值你原数组元素数量是万个级别vb.net去除重复值的,就直接ReDim Temp(H),下面 ReDim Preserve Temp(K) 去掉
Temp(0) = b(0)
For I = 0 To H
IsNew = True
For J = 0 To K
If Temp(J) = b(I) Then
IsNew = False
Exit For
End If
Next J
If IsNew Then
K = K + 1
ReDim Preserve Temp(K)
Temp(K) = b(I)
End If
Next I
ReDim b(K)
For I = 0 To K
b(I) = Temp(I)
Next I
Erase Temp()
End Function
'调用
'dim b() as integer
'dim I as integer
'dim OutputStr as String
'redim b(Ubound(a()))
'for I=0 TO Ubound(a())
'b(I)=a(I)
'next I
'NewArray(b())
'返回vb.net去除重复值的b()为除重后vb.net去除重复值的数组 , 可以根据你的需要显示、输出数组a()、b() 。
【vb.net去除重复值 vba 大量 去重复 速度最快】关于vb.net去除重复值和vba 大量 去重复 速度最快的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息 , 记得收藏关注本站 。

    推荐阅读