提供个数组重复过滤算法

来源:百度知道 编辑:UC知道 时间:2024/05/17 15:48:57

function removeDuplication(byref sourceArray()) as variant()
..dim returns()
..dim uboundReturns as integer:uboundReturns = -1
..dim i as integer, j as integer
..for i=0 to ubound(sourceArray)
....dim found as boolean:found=false
....for j=0 to uboundReturns - 1
......if (sourceArray(i) = returns(j)) then found = true
....next
....if (not found) then
......uboundReturns = uboundReturns + 1
......redim preserve returns(uboundReturns)
......returns(uboundReturns) = sourceArray(i)
....endif
..next
..
..removeDuplication = returns
end function