See the top rated post in this thread. Click here

Results 1 to 4 of 4

Thread: List filter

  1. #1
    Member
    Join Date
    2010-09
    Posts
    24
    Login to Give a bone
    0

    Default List filter

    I have the following list:
    Code:
    ("AND" "CNF" "SND" "X1P"... "X2P" "Y3N"... "Z1P"...)
    I would like to get a list of all elements that start with the letters X and Y.
    return:
    Code:
    ("X1P"... "X2P" "Y3N"...)
    Any help will be appreciated.

    Thank in advance.
    Last edited by BlackBox; 2014-10-10 at 06:53 PM. Reason: Please use [CODE] Tags

  2. #2
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    1

    Default Re: List filter

    Quote Originally Posted by antistar View Post
    I have the following list:
    ("AND" "CNF" "SND" "X1P"... "X2P" "Y3N"... "Z1P"...)

    I would like to get a list of all elements that start with the letters X and Y.
    return:
    ("X1P"... "X2P" "Y3N"...)

    Any help will be appreciated.

    Thank in advance.
    Code:
    (vl-load-com)
    
    (defun _RemoveIfNot (match lst)
      ;; Example:
      ;; (_RemoveIfNot "X*,Y*" '("AND" "CNF" "SND" "X1P" "X2P" "Y3N" "Z1P"))
      (vl-remove-if-not (function (lambda (x) (wcmatch x match))) lst)
    )
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  3. #3
    Member
    Join Date
    2010-09
    Posts
    24
    Login to Give a bone
    0

    Default Re: List filter

    Hi BlackBox,
    Excellent!!! You saved my date.
    Thanks for your attention and sharing your knowledge.

    Cheers.
    Last edited by antistar; 2014-10-10 at 07:39 PM.

  4. #4
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: List filter

    Quote Originally Posted by antistar View Post
    Hi BlackBox,
    Excellent!!! You saved my date.
    Thanks for your attention and for sharing their knowledge.

    Cheers.
    That is kind of you to say, antistar; I'm happy to help.

    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

Similar Threads

  1. 2015: sorting av filter list
    By Christopher_L in forum Revit - Platform
    Replies: 4
    Last Post: 2015-09-04, 08:12 PM
  2. Sort Filter List
    By Wish List System in forum Revit Architecture - Wish List
    Replies: 0
    Last Post: 2014-08-28, 01:52 PM
  3. Filter BOM Items & Qty on Parts List
    By Wish List System in forum Inventor Wish List
    Replies: 0
    Last Post: 2013-11-11, 08:37 PM
  4. Filter in view reference list
    By Wish List System in forum Revit Architecture - Wish List
    Replies: 0
    Last Post: 2013-10-29, 01:33 PM
  5. Parts list filter for Level of Details
    By inventor.wishlist1738 in forum Inventor Wish List
    Replies: 0
    Last Post: 2008-10-05, 06:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •