How do I find if a number is part of a number range in this format 1-12,14-16,33,35

Discussion in 'AutoCAD' started by Tom, Jun 30, 2004.

  1. Tom

    Tom Guest

    How do I find if a number is part of a number range in this format
    1-12,14-16,33,35...

    Something like (member number '1-12,14-16,33,35)



    Thanks

    Tom
     
    Tom, Jun 30, 2004
    #1
  2. Tom

    Paul Turvill Guest

    (or (<= 1 n 12)(<= 14 n 16)(= n 33)(= n 35))
    ___
     
    Paul Turvill, Jun 30, 2004
    #2
  3. Tom

    ECCAD Guest

    Do you mean you want to see if 10 or 15 is in there ?

    Bob
     
    ECCAD, Jun 30, 2004
    #3
  4. Tom

    Tom Guest

    Yes.
    Thanks,
    Any ideas?
     
    Tom, Jun 30, 2004
    #4
  5. Tom

    Paul Turvill Guest

    Oh, and just in case--here's a dialog of the app in use:

    Command: (load"range")
    RANGE
    Command: (setq RangeList "1-6,9-12,24,35,44-60")
    "1-6,9-12,24,35,44-60"
    Command: (range 5 RangeList)
    T
    Command: (range 10 RangeList)
    T
    Command: (range 7 RangeList)
    nil
    Command: (range 24 RangeList)
    T
    Command: (range 61 RangeList)
    nil
    ____
     
    Paul Turvill, Jul 1, 2004
    #5
  6. (defun MatchInteger (IntNum PatStr)
    (wcmatch (itoa IntNum) PatStr)
    )

    Command: (MatchInteger 15 "[1-9],1[0-2456],33,35")
    T
     
    Marc'Antonio Alessi, Jul 1, 2004
    #6
  7. what is the segment "1[0-2456]" represent?
    (MatchInteger 245 "[1-9],1[0-2456],33,35") returns nil
     
    Alan Henderson @ A'cad Solutions, Jul 1, 2004
    #7
  8. what is the segment "1[0-2456]" represent?

    10-12 14 15 16

    press "F1" and search "wcmatch"
     
    Marc'Antonio Alessi, Jul 1, 2004
    #8
  9. Tom

    Paul Turvill Guest

    That pairs "1" with 0 to 2, and 4, 5, and 6; i.e., 10,11,12,14,15,16.

    However, if the OP rejected my first recommendation, he's not likely to take
    this one, either.
    ___
     
    Paul Turvill, Jul 1, 2004
    #9
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.