Function: string-lessp

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

Signature

(string-lessp STRING1 STRING2)

Documentation

Return non-nil if STRING1 is less than STRING2 in lexicographic order.

Case is significant. Symbols are also allowed; their print names are used instead.

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

View in manual

Probably introduced at or before Emacs version 20.4.

Shortdoc

;; string
(string-lessp "abc" "def")
    => t
  (string-lessp "pic4.png" "pic32.png")
    => nil
  (string-lessp "1.1" "1.2")
    => t
;; comparison
(string-lessp "abc" "abd")
    => t
  (string-lessp "abc" "abc")
    => nil
  (string-lessp "pic4.png" "pic32.png")
    => nil

Aliases

string<

Source Code

// Defined in /usr/src/emacs/src/fns.c
{
  if (SYMBOLP (string1))
    string1 = SYMBOL_NAME (string1);
  else
    CHECK_STRING (string1);
  if (SYMBOLP (string2))
    string2 = SYMBOL_NAME (string2);
  else
    CHECK_STRING (string2);

  return string_cmp (string1, string2) < 0 ? Qt : Qnil;
}