This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

Detect String

3 posts · 2134 views

In CLISP, how to detect whether an object is a string or not?

Re: Detect String

You can use STRINGP.
[1]> (stringp "abc")
T
[2]> (stringp 100)
NIL
In general, TYPECASE and CTYPECASE are often more useful.
(typecase x
  (string
   (format t "~&X is a string."))
  (number
   (format t "~&X is a number."))
  (t
   (format t "~&X is... something.")))

Re: Detect String

Thanks everyone!