Author Topic: character or number  (Read 1910 times)

0 Members and 1 Guest are viewing this topic.

TopoWAR

  • Newt
  • Posts: 135
character or number
« on: April 08, 2012, 07:43:48 PM »
hello, as if the string is a number or character (letter)
example:
Code: [Select]
(setq x "b" x1 "1")I need a command that I distinguish between number and letter,
something like dos_strischar of DOSLib but in AutoLISP
thanks
Thanks for help

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: character or number
« Reply #1 on: April 08, 2012, 08:31:13 PM »
Code: [Select]
(wcmatch <string> "@")
Code: [Select]
(wcmatch <string> "#")
Code: [Select]
(type (read <string>))
Code: [Select]
(< 47 (ascii <string>) 58)
Code: [Select]
(vl-every '(lambda ( c ) (< 47 c 58)) (vl-string->list <string>))
Code: [Select]
(distof <string>)
« Last Edit: April 08, 2012, 08:34:33 PM by Lee Mac »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: character or number
« Reply #2 on: April 08, 2012, 08:31:47 PM »
Code - Auto/Visual Lisp: [Select]
  1. (numberp (read x1))
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

TopoWAR

  • Newt
  • Posts: 135
Re: character or number
« Reply #3 on: April 08, 2012, 08:33:31 PM »
thank you very much, teachers :-D
Thanks for help

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: character or number
« Reply #4 on: April 09, 2012, 07:58:19 AM »
Has anyone seen the cat?  :evil:
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: character or number
« Reply #5 on: April 09, 2012, 12:44:23 PM »
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox