Function: string-collate-equalp

string-collate-equalp is a function defined in fns.c.

Signature

(string-collate-equalp S1 S2 &optional LOCALE IGNORE-CASE)

Documentation

Return t if two strings have identical contents.

Symbols are also allowed; their print names are used instead.

This function obeys the conventions for collation order in your locale settings. For example, characters with different coding points but the same meaning might be considered as equal, like different grave accent Unicode characters:

(string-collate-equalp (string ?\uFF40) (string ?\u1FEF))
  => t

The optional argument LOCALE, a string, overrides the setting of your current locale identifier for collation. The value is system dependent; a LOCALE "en_US.UTF-8" is applicable on POSIX systems, while it would be "enu_USA.1252" on MS Windows systems.

If IGNORE-CASE is non-nil, characters are converted to lower-case before comparing them.

To emulate Unicode-compliant collation on MS-Windows systems, bind w32-collate-ignore-punctuation to a non-nil value, since the codeset part of the locale cannot be "UTF-8" on MS-Windows.

If your system does not support a locale environment, this function behaves like string-equal, and in that case the IGNORE-CASE argument is ignored.

Do NOT use this function to compare file names for equality.

View in manual

Probably introduced at or before Emacs version 25.1.

Source Code

// Defined in /usr/src/emacs/src/fns.c
{
#if defined __STDC_ISO_10646__ || defined WINDOWSNT
  /* Check parameters.  */
  if (SYMBOLP (s1))
    s1 = SYMBOL_NAME (s1);
  if (SYMBOLP (s2))
    s2 = SYMBOL_NAME (s2);
  CHECK_STRING (s1);
  CHECK_STRING (s2);
  if (!NILP (locale))
    CHECK_STRING (locale);

  return (str_collate (s1, s2, locale, ignore_case) == 0) ? Qt : Qnil;

#else  /* !__STDC_ISO_10646__, !WINDOWSNT */
  return Fstring_equal (s1, s2);
#endif /* !__STDC_ISO_10646__, !WINDOWSNT */
}