Author Topic: Greater than and Less than  (Read 1989 times)

0 Members and 1 Guest are viewing this topic.

whdjr

  • Guest
Greater than and Less than
« on: December 13, 2005, 12:25:32 PM »
What would be the easiest way to test if a num was between two numbers without declaring any variables?

Code: [Select]
(setq enum "5")
(< (> (ascii enum) 49) 57)

I am trying to determine if a string is really a number or if it is a letter.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Greater than and Less than
« Reply #1 on: December 13, 2005, 12:28:26 PM »
(< 4 5 6)

Tim
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Greater than and Less than
« Reply #2 on: December 13, 2005, 12:30:27 PM »
Code: [Select]
(defun IsDigit ( x )
    (< 47 (ascii x) 58)
)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: Greater than and Less than
« Reply #3 on: December 13, 2005, 12:30:41 PM »
Checkout the following [ http://www.theswamp.org/forum/index.php?topic=3710.0 ] CAB has one in there as well.
TheSwamp.org  (serving the CAD community since 2003)

whdjr

  • Guest
Re: Greater than and Less than
« Reply #4 on: December 13, 2005, 03:47:38 PM »
Thanks guys that's what I needed.  I knew I had seen a way like that I just come up with it.