[Top][All Lists]

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

Re: case-insensitive string comparison

From: Roland Winkler
Subject: Re: case-insensitive string comparison
Date: Tue, 19 Jul 2022 14:39:32 -0500

On Tue, Jul 19 2022, Sam Steingold wrote:
> Specifically, I would like to add
> (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)))
> to subr.el next to `string-prefix-p' - is this okay?

I have run into this problem fairly often that I needed case-insensitive
string comparison, and I believe various elisp packages include a
"private" version of the above.  I always felt that
`(eq t (compare-strings s1 0 nil s2 0 nil t))' was a crutch for this
common problem.  Would it make sense to give the built-in function
string-equal an optional arg ignore-case?

reply via email to

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