
1个回答
展开全部
假设两个数组为 a() b() 序号从1开始
function getfirstsame(a,b)
dim t1,t2,lena,lenb
lena=ubound(a)
lenb=ubound(b)
for t1=1 to lena
for t2=1 to lenb
if a(t1)=b(t2) then
'得到相同的,就退出
getfirstsame=a(t1)
exit function
end if
next
next
getfirstsame="没有找到"
End function
v=getfirstsame(a,b) '得到第一个相同的
function getfirstsame(a,b)
dim t1,t2,lena,lenb
lena=ubound(a)
lenb=ubound(b)
for t1=1 to lena
for t2=1 to lenb
if a(t1)=b(t2) then
'得到相同的,就退出
getfirstsame=a(t1)
exit function
end if
next
next
getfirstsame="没有找到"
End function
v=getfirstsame(a,b) '得到第一个相同的
追问
不行啊,代码有错误啊
追答
不知道你怎么用的,我在本地调试没问题
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询