Author Topic: Alternative with wcmatch  (Read 1861 times)

0 Members and 1 Guest are viewing this topic.

Grrr1337

  • Swamp Rat
  • Posts: 812
Alternative with wcmatch
« 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").

(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: Alternative with wcmatch
« Reply #1 on: May 29, 2019, 08:21:34 AM »
Use a double-negative, e.g.:

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

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: Alternative with wcmatch
« Reply #2 on: May 29, 2019, 08:49:47 AM »
Use a double-negative, e.g.:

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

Thanks Lee!

Cheers! :beer:
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg