Community
Hi,
I have a list like ("a.dwg" "b.dwg" "c.dwg")
and an filename "b.dwg"
I want to know if the filename is a part of the list.
which function must be used for this?
---
André
(setq dwg-list (list "a.dwg" "b.dwg" "c.dwg")) (setq dwg-to-search "b.dwg") (if (member dwg-to-search dwg-list) (alert (strcat "\n" dwg-to-search " exists" )) (alert (strcat "\n" dwg-to-search " do not exists")) )
Another with function vl-position .
(setq lst (list "a.dwg" "b.dwg" "c.dwg")) (if (vl-position "b.dwg" lst) (alert "File name is found") (alert "File name not found") )
Tharwat
Another with foreach function
(foreach x (list "a.dwg" "b.dwg" "c.dwg") (if (eq "b.dwg" x) (setq found t) ) ) (if found (alert "File name is found"))