[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: Wed, 20 Jul 2022 11:24:38 -0500

On Tue, Jul 19 2022, Stefan Monnier wrote:
>> PS. Actually, compare-strings/ignore_case is broken because it does,
>> essentially, upcase both arguments, see
>> https://stackoverflow.com/q/319426/850781
> Hmm... `string-collate-equalp`?

It would be nice if the node in the elisp manual on "comparison of
characters and strings" included some discussion on what usage cases
with case-folding can / should preferentially be covered by the
locale-dependent function string-collate-equalp versus something like

In my narrow world, I can think of two extremes:

- bibtex-mode needs to compare BibTeX keywords that are ascii strings
  for which case is insignificant.  So bibtex-string= is exactly what
  Sam suggests to put into subr.el, and I believe that's good enough
  (just as almost any other approach I can think of for this particular

- BBDB needs to know whether a name is already present in the database
  or not, ignoring case.  The function bbdb-string= is again what Sam
  suggests to put into subr.el.  The function string-collate-equalp
  might be better suited for this.  But which locale should it use?  The
  records in my BBDB cover larger parts of the world and I do not even
  know which locale(s) might work best for each of them, not to mention
  that BBDB needs to loop over all records.  Is there a "univeral
  default locale"?

reply via email to

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