asp 怎么过过滤重复的单词
发布网友
发布时间:2022-09-25 15:24
我来回答
共1个回答
热心网友
时间:2023-09-18 14:27
我喜欢用栈的思路来解决...
public function inArray(arr_, val_)
dim i,rt : rt = -1
for i = 0 to Ubound(arr_)
if arr_(i) = val_ then
rt = i
exit for
end if
next
inArray = rt
end function
public function ArrayPush(arr_, ByVal val_)
dim i,n,tmp
n = Ubound(arr_)
tmp = arr_
redim preserve tmp(n+1)
tmp(n+1) = val_
arr_ = tmp
ArrayPush = n+1
end function
a = split("aa bb aa bb ee cc aa dd ee ff"," ")
b = Array()
for i = 0 to ubound(a)
if inArray(b,a(i)) = -1 then call ArrayPush(b,a(i))
next
Response.Write Join(b," ")