TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Grrr1337 on May 29, 2019, 07:41:01 AM

Title: Alternative with wcmatch
Post by: Grrr1337 on May 29, 2019, 07:41:01 AM
Hey guys,
So I have these Roman numbers, such as "VI"; "XX"; "XIV"; "XXIV"; "XXXIV"
and I'm iterating a selection set with "TEXT" objects (on a particular layer) in order to filter these in -

Code: [Select]
(repeat (setq i (sslength SS))
  (setq enx (entget (ssname SS (setq i (1- i)))))
  (setq s (cdr (assoc 1 enx)))
  (if (vl-every (function (lambda (x) (member x '(88 73 86)))) (vl-string->list s))
    (setq L (cons enx L))
  )
)

I'm not that good with the wcmatch function, so my question is how I could substitute the vl-every check I did with it ?
Meaning that every character of the string is a member of '("X" "I" "V").

Title: Re: Alternative with wcmatch
Post by: Lee Mac on May 29, 2019, 08:21:34 AM
Use a double-negative, e.g.:

Code: [Select]
(wcmatch str "~*[~XIV]*")
Title: Re: Alternative with wcmatch
Post by: Grrr1337 on May 29, 2019, 08:49:47 AM
Use a double-negative, e.g.:

Code: [Select]
(wcmatch str "~*[~XIV]*")

Thanks Lee!

Cheers! :beer: