Author Topic: Know if a string is letter or number  (Read 8864 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Know if a string is letter or number
« Reply #15 on: April 23, 2015, 12:22:02 PM »
Personally, I would take the approach that anything that distof is able to convert is a valid numerical input, since any input which may be converted using distof can also be generated using rtos.

andrew_nao

  • Guest
Re: Know if a string is letter or number
« Reply #16 on: April 27, 2015, 11:26:35 AM »
Code: [Select]
(if (wcmatch str "*@*")
  (princ "\nIt is a string.")
  (princ "\nIt is a number")
)

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: Know if a string is letter or number
« Reply #17 on: April 27, 2015, 11:58:29 AM »
Code: [Select]
(if (wcmatch str "*@*")
  (princ "\nIt is a string.")
  (princ "\nIt is a number")
)
Comando: (if (wcmatch "." "*@*")   (princ "\nIt is a string.")  (princ "\nIt is a number"))
=> It is a number