mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-02-01 20:06:00 +00:00
Update description of string comparison functions
* doc/lispref/strings.texi (Text Comparison): Swap descriptions of 'string-equal' (the function) and 'string=' (its alias). Same for 'string-lessp' and 'string<'. Document 'string>'. (Bug#72486) * doc/lispref/sequences.texi (Sequence Functions): Update cross reference to 'string-lessp'.
This commit is contained in:
parent
3817355aed
commit
4dc9e99349
@ -468,8 +468,9 @@ Specifically:
|
||||
@item
|
||||
Numbers are compared using @code{<} (@pxref{definition of <}).
|
||||
@item
|
||||
Strings are compared using @code{string<} (@pxref{definition of
|
||||
string<}) and symbols are compared by comparing their names as strings.
|
||||
Strings are compared using @code{string-lessp} (@pxref{definition of
|
||||
string-lessp}) and symbols are compared by comparing their names as
|
||||
strings.
|
||||
@item
|
||||
Conses, lists, vectors and records are compared lexicographically. This
|
||||
means that the two sequences are compared element-wise from left to
|
||||
|
@ -502,7 +502,7 @@ in case if @code{case-fold-search} is non-@code{nil}.
|
||||
@end example
|
||||
@end defun
|
||||
|
||||
@defun string= string1 string2
|
||||
@defun string-equal string1 string2
|
||||
This function returns @code{t} if the characters of the two strings
|
||||
match exactly. Symbols are also allowed as arguments, in which case
|
||||
the symbol names are used. Case is always significant, regardless of
|
||||
@ -513,25 +513,25 @@ This function is equivalent to @code{equal} for comparing two strings
|
||||
the two strings are ignored; use @code{equal-including-properties} if
|
||||
you need to distinguish between strings that differ only in their text
|
||||
properties. However, unlike @code{equal}, if either argument is not a
|
||||
string or symbol, @code{string=} signals an error.
|
||||
string or symbol, @code{string-equal} signals an error.
|
||||
|
||||
@example
|
||||
(string= "abc" "abc")
|
||||
(string-equal "abc" "abc")
|
||||
@result{} t
|
||||
(string= "abc" "ABC")
|
||||
(string-equal "abc" "ABC")
|
||||
@result{} nil
|
||||
(string= "ab" "ABC")
|
||||
(string-equal "ab" "ABC")
|
||||
@result{} nil
|
||||
@end example
|
||||
|
||||
A unibyte and a multibyte string are equal in the sense of
|
||||
@code{string=} if and only if they contain the same sequence of
|
||||
@code{string-equal} if and only if they contain the same sequence of
|
||||
character codes all being in the range 0--127 (@acronym{ASCII}).
|
||||
@xref{Text Representations}.
|
||||
@end defun
|
||||
|
||||
@defun string-equal string1 string2
|
||||
@code{string-equal} is another name for @code{string=}.
|
||||
@defun string= string1 string2
|
||||
@code{string=} is another name for @code{string-equal}.
|
||||
@end defun
|
||||
|
||||
@defun string-equal-ignore-case string1 string2
|
||||
@ -597,9 +597,8 @@ that collation implements.
|
||||
@end defun
|
||||
|
||||
@cindex lexical comparison of strings
|
||||
@anchor{definition of string<}
|
||||
@defun string< string1 string2
|
||||
@c (findex string< causes problems for permuted index!!)
|
||||
@anchor{definition of string-lessp}
|
||||
@defun string-lessp string1 string2
|
||||
This function compares two strings a character at a time. It
|
||||
scans both the strings at the same time to find the first pair of corresponding
|
||||
characters that do not match. If the lesser character of these two is
|
||||
@ -618,11 +617,11 @@ multibyte non-@acronym{ASCII} character (@pxref{Text Representations}).
|
||||
|
||||
@example
|
||||
@group
|
||||
(string< "abc" "abd")
|
||||
(string-lessp "abc" "abd")
|
||||
@result{} t
|
||||
(string< "abd" "abc")
|
||||
(string-lessp "abd" "abc")
|
||||
@result{} nil
|
||||
(string< "123" "abc")
|
||||
(string-lessp "123" "abc")
|
||||
@result{} t
|
||||
@end group
|
||||
@end example
|
||||
@ -634,15 +633,15 @@ no characters is less than any other string.
|
||||
|
||||
@example
|
||||
@group
|
||||
(string< "" "abc")
|
||||
(string-lessp "" "abc")
|
||||
@result{} t
|
||||
(string< "ab" "abc")
|
||||
(string-lessp "ab" "abc")
|
||||
@result{} t
|
||||
(string< "abc" "")
|
||||
(string-lessp "abc" "")
|
||||
@result{} nil
|
||||
(string< "abc" "ab")
|
||||
(string-lessp "abc" "ab")
|
||||
@result{} nil
|
||||
(string< "" "")
|
||||
(string-lessp "" "")
|
||||
@result{} nil
|
||||
@end group
|
||||
@end example
|
||||
@ -651,8 +650,8 @@ Symbols are also allowed as arguments, in which case their print names
|
||||
are compared.
|
||||
@end defun
|
||||
|
||||
@defun string-lessp string1 string2
|
||||
@code{string-lessp} is another name for @code{string<}.
|
||||
@defun string< string1 string2
|
||||
@code{string<} is another name for @code{string-lessp}.
|
||||
@end defun
|
||||
|
||||
@defun string-greaterp string1 string2
|
||||
@ -661,6 +660,10 @@ This function returns the result of comparing @var{string1} and
|
||||
@code{(string-lessp @var{string2} @var{string1})}.
|
||||
@end defun
|
||||
|
||||
@defun string> string1 string2
|
||||
@code{string>} is another name for @code{string-greaterp}.
|
||||
@end defun
|
||||
|
||||
@cindex locale-dependent string comparison
|
||||
@defun string-collate-lessp string1 string2 &optional locale ignore-case
|
||||
This function returns @code{t} if @var{string1} is less than
|
||||
|
Loading…
Reference in New Issue
Block a user