Function: string-equal

string-equal is a function defined in fns.c.

Signature

(string-equal S1 S2)

Documentation

Return t if two strings have identical contents.

Case is significant, but text properties are ignored. Symbols are also allowed; their print names are used instead.

Other relevant functions are documented in the string group.

Probably introduced at or before Emacs version 25.1.

Shortdoc

;; string
(string-equal "foo" "foo")
    => t

Aliases

string=

Source Code

// Defined in /usr/src/emacs/src/fns.c
{
  if (SYMBOLP (s1))
    s1 = SYMBOL_NAME (s1);
  if (SYMBOLP (s2))
    s2 = SYMBOL_NAME (s2);
  CHECK_STRING (s1);
  CHECK_STRING (s2);

  if (SCHARS (s1) != SCHARS (s2)
      || SBYTES (s1) != SBYTES (s2)
      || memcmp (SDATA (s1), SDATA (s2), SBYTES (s1)))
    return Qnil;
  return Qt;
}