主题:  关于DR中数组查找问题

skyme

职务:普通成员
等级:1
金币:0.0
发贴:28
#12002/2/15 14:53:35
先定义一个数组,如numlist=["a","ab","cd","ef","b"]
要查找"cd"所在的数组位置,如何实现呢?
是用findPos(numlist,"cd")实现吗?本人试过却出错,



zzcrc

职务:普通成员
等级:3
金币:1.0
发贴:961
#22002/2/18 19:28:04
global numlist
flag=0
searchText=member("searchText").text
repeat with i=1 to count(numlist)
if (numlist[i] contains searchText) then
member("show").text=numlist[i]
flag=1
exit repeat
end if
end repeat
if flag=0 then
member("show").text="没有这个内容"
alert"没有找到"
end if



rainy_5d

职务:普通成员
等级:2
金币:1.0
发贴:225
#32002/2/18 21:27:06
--在message window中测试
numlist=["a","ab","cd","ef","b"]
x=numlist.getPos("cd")
put x
-- 3

应该使用getpos,findpos用于property list