emacs-devel
[Top][All Lists]
Advanced

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

Re: case-insensitive string comparison


From: Eli Zaretskii
Subject: Re: case-insensitive string comparison
Date: Mon, 25 Jul 2022 18:58:19 +0300

> From: Sam Steingold <sds@gnu.org>
> Date: Mon, 25 Jul 2022 10:23:30 -0400
> 
> >> Hmm... `string-collate-equalp`?
> >
> > (string-collate-equalp "a" "A" current-locale-environment t)
> > ==> nil
> > current-locale-environment
> > ==> "en_US.UTF-8"

I cannot reproduce this:

  (string-collate-equalp "a" "A" current-locale-environment t)
    => t
  current-locale-environment
    => "en_US.UTF-8"

What OS is this, and which Emacs version?

> So, how do we do case-insensitive string comparison in Emacs?

If you want locale-specific collation, as Stefan said, above.

> It is okay to add a `string-equal-ignore-case' based on `compare-strings'?
> (even though it does not recognize "SS" and "ß" as equal)

What's wrong with calling compare-strings directly?

> Or should we first implement something like casefold in Python?
> https://docs.python.org/3/library/stdtypes.html#str.casefold

Ha! we already have that:

  (get-char-code-property ?ß 'special-uppercase)
    => "SS"

Give us some credit, yes?



reply via email to

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