Skip to content
character-classes.lisp 695 B
Newer Older
#+xcvb (module (:depends-on ("pkgdcl")))

(in-package :rpm)

;; TODO: move this to FARE-UTILS or somewhere else???

(defun ascii-char-p (x)
  (and (characterp x) (<= 0 (char-code x) 127)))

(defun ascii-uppercase-letter-p (x)
  (char<= #\A x #\Z))

(defun ascii-lowercase-letter-p (x)
  (char<= #\a x #\z))

(defun ascii-letter-p (x)
  (or (ascii-uppercase-letter-p x) (ascii-lowercase-letter-p x)))

(defun ascii-digit-p (x)
  (char<= #\0 x #\9))

(defun ascii-alphanumeric-p (x)
  (or (ascii-letter-p x) (ascii-digit-p x)))

(defun ascii-non-alphanumeric-p (x)
  (not (ascii-alphanumeric-p x)))

(defun ascii-alphanumeric-or-underscore-p (x)
  (or (ascii-alphanumeric-p x)
      (eql x #\_)))