help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: idiomatic case-insensitive string comparison?


From: Sam Steingold
Subject: Re: idiomatic case-insensitive string comparison?
Date: Mon, 18 Jul 2022 15:41:28 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin)

Apparently, I need to do

--8<---------------cut here---------------start------------->8---
(defun string=-ic (a b)
  "case-insensitive string equality test"
  (eq t (compare-strings a nil nil b nil nil t)))
--8<---------------cut here---------------end--------------->8---

I discovered `compare-strings' by noticing that `string-prefix-p'
accepts an IGNORE-CASE argument and looking at its source code.

-- 
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.2113
http://childpsy.net http://calmchildstories.com http://steingoldpsychology.com
https://www.peaceandtolerance.org/ https://camera.org https://ffii.org
Between grand theft and a legal fee, there only stands a law degree.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]