[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) |
Hi,
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.,
`minibuffer-history-case-insensitive-variables'
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?
Thanks.
--
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.
- case-insensitive string comparison,
Sam Steingold <=
Re: case-insensitive string comparison, Stefan Kangas, 2022/07/19
Re: case-insensitive string comparison, Roland Winkler, 2022/07/19