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.

See also string-equal-ignore-case.

Other relevant functions are documented in the comparison and string groups.

View in manual

Probably introduced at or before Emacs version 25.1.

Shortdoc

;; string
(string-equal "abc" "abc")
    => t
  (string-equal "abc" "ABC")
    => nil
;; comparison
(string-equal "abc" "abc")
    => t
  (string-equal "abc" "ABC")
    => nil

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;
}