Q: how does one test string equality but ignore case?
I've got a situation in which I'd like to compare strings but ignore case. Case is significant for string-equal
, and apparently is insensitive to case-fold-search
:
(string-equal "string" "StrinG") ; => nil
(let ((case-fold-search t))
(string-equal "string" "StrinG")) ; => nil
I could always preprocess the strings (say, with downcase
) before comparing them:
(string-equal (downcase "string")
(downcase "StrinG")) ; => t
But that seems like overkill to do two extra function calls every time. Have I overlooked the relevant predicate function somewhere?