在列表中搜索字符串
大家好,我想用lisp搜索列表中的字符串,任何人都可以帮我。
ex(setq a(列表“1”“2”“3”))
现在我想在列表中搜索“2”。
非常感谢。 只需将列表和搜索字符串传递给函数
前任:
(定义c:测试(/a是)
(setq a(列表“1”“2”“3”))
(setq yes(搜索字符串a“2”))
(如果(=是t)
(提示“找到”)
(提示“未找到”)
)
)
(defun searchstring(searchlist search/sealen sea anwser str)
(setq sealen(长度搜索列表))
(setq sea 0)
(setq anwser nil)
(虽然(
(setq str(第n个sea搜索列表))
(if(=(strcase search)(strcase str))
(程序
(setq anwser t)
)
)
(如果(=anwser t)
(setq sealen)
)
(setq海(+1海))
)
anwser公司
) 如果在具有成员函数的列表中找到某个成员,则可以检查该成员。
例如
(setq a (list "1" "2" "3"))
(member "2" a)
请阅读代码发布指南并编辑您的帖子,将代码包含在代码标签中。 谢谢你的回复。
不客气。
页:
[1]