stringp
Stringp is a predicate function in Lisp-family languages used to test whether a given object is a string. In Common Lisp, (stringp x) returns true (T or non-nil) if x is an instance of the built-in string type, and nil otherwise. The function does not attempt to coerce or convert the argument; it purely reports whether the argument is already a string. For practical purposes, stringp is often used as a convenient shorthand for a type check, similar in effect to (typep x 'string).
- (stringp (make-string 5 :initial-element #\a)) => T
- String validation: (when (stringp s) ... ) to execute code only for strings.
- Conditional branches can rely on stringp to distinguish strings from other object types in input handling
- In Common Lisp, stringp is a standard, built-in predicate and is widely used in conjunction with
- In some other Lisp dialects, the analogous check may be provided by a different name (for
- See also typep, string, and make-string for related type and string operations.
Overall, stringp provides a concise, reliable way to confirm that a value is a string before performing