anonymous
anonymous

Reputation: 1532

Built-in case insensitive string=

I need to compare two strings ignoring the case for the assoc :test function. I know that I can easily write the function like so:

(defun cistring= (str1 str2)
  (string= (string-downcase str1)
           (string-downcase str2)))

However I was wondering: Is there is a built-in case insensitive string=? Or maybe I just cannot find any?

Upvotes: 1

Views: 568

Answers (1)

jkiiski
jkiiski

Reputation: 8411

STRING-EQUAL compares strings case insensitively (characters are CHAR-EQUAL).

CL-USER> (string-equal "foo" "FOO")
T
CL-USER> (string-equal "foo" "FOOBAR" :end2 3)
T

Upvotes: 6

Related Questions