[Top][All Lists]

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

case-insensitive string comparison

From: Sam Steingold
Subject: case-insensitive string comparison
Date: Tue, 19 Jul 2022 13:27:50 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin)


Emacs Lisp has 3 ways to describe comparison that ignores case:

1. "ignore-case", as in, e.g., `member-ignore-case'
2. "case-fold", as in, e.g., `case-fold-search'
3. "case-insensitive", as in, e.g., 

Is there a general rule when to use which naming?

Specifically, I would like to add

--8<---------------cut here---------------start------------->8---
(defun string-equal-ignore-case (s1 s2)
  "Like `string-equal', but case-insensitive.
Upper-case and lower-case letters are treated as equal.
Unibyte strings are converted to multibyte for comparison."
  (eq t (compare-strings s1 0 nil s2 0 nil t)))
--8<---------------cut here---------------end--------------->8---

to subr.el next to `string-prefix-p' - is this okay?


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://ij.org/ https://www.memritv.org
Sex is like air.  It's only a big deal if you can't get any.

reply via email to

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