使用wildc删除列表项
如何使用通配符查询从列表中删除项目:(“big23”“large25”“superlarge26”“superlarge-27”“superlarge_28”等)
到
(“big23”“large25”等等),只需删除“超大…”零件)
伙计们,先谢谢你们。 你好
带有mapcar和lambda函数的单向。
(mapcar '(lambda (x)
(if (wcmatch x "superlarge*")
(substr x 12)
x
)
)
'("big23" "large25" "superlarge26" "superlarge-27" "superlarge_28")
) @Tharwat我认为@paulo whant删除项目,而不是字符串的一部分:
以下是我的解决方案:
[列表=1]
[*]使用本文中的parse list函数
使用示例:
(pz:LST_Parse
'("big23" "large25" "superlarge26" "superlarge-27" "superlarge_28")
'(lambda (%) (wcmatch % "superla*"))
t
)
[*]或在函数
(vl-remove-if
'(lambda (%) (wcmatch % "superla*"))
'("big23" "large25" "superlarge26" "superlarge-27" "superlarge_28")
)
编辑:
今天我注意到我的论坛排名:新星-我爱它https://www.cadtutor.net/forum/uploads/emoticons/smile.png.d39a2e41e91a6e6678d2c801eef03a4b.png vl remove if行为的另一个变体:
(apply 'append
(mapcar
'(lambda (x)
(if (wcmatch x "superla*") (list x))
)
'("big23" "large25" "superlarge26" "superlarge-27" "superlarge_28")
)
) 和往常一样,这个论坛是像我这样的“学习者”的必经之路。还有什么要说的,这里又是一个快乐的露营者,非常感谢。直到下一次。。。
页:
[1]