417 |
strings. When @code{equal} (@pxref{Equality Predicates}) compares two |
strings. When @code{equal} (@pxref{Equality Predicates}) compares two |
418 |
strings, it uses @code{string=}. |
strings, it uses @code{string=}. |
419 |
|
|
420 |
If the strings contain non-@acronym{ASCII} characters, and one is unibyte |
For technical reasons, a unibyte and a multibyte string are |
421 |
while the other is multibyte, then they cannot be equal. @xref{Text |
@code{equal} if and only if they contain the same sequence of |
422 |
|
character codes and all these codes are either in the range 0 through |
423 |
|
127 (@acronym{ASCII}) or 160 through 255 (@code{eight-bit-graphic}). |
424 |
|
However, when a unibyte string gets converted to a multibyte string, |
425 |
|
all characters with codes in the range 160 through 255 get converted |
426 |
|
to characters with higher codes, whereas @acronym{ASCII} characters |
427 |
|
remain unchanged. Thus, a unibyte string and its conversion to |
428 |
|
multibyte are only @code{equal} if the string is all @acronym{ASCII}. |
429 |
|
Character codes 160 through 255 are not entirely proper in multibyte |
430 |
|
text, even though they can occur. As a consequence, the situation |
431 |
|
where a unibyte and a multibyte string are @code{equal} without both |
432 |
|
being all @acronym{ASCII} is a technical oddity that very few Emacs |
433 |
|
Lisp programmers ever get confronted with. @xref{Text |
434 |
Representations}. |
Representations}. |
435 |
@end defun |
@end defun |
436 |
|
|
505 |
the string). |
the string). |
506 |
|
|
507 |
The strings are both converted to multibyte for the comparison |
The strings are both converted to multibyte for the comparison |
508 |
(@pxref{Text Representations}) so that a unibyte string can be equal to |
(@pxref{Text Representations}) so that a unibyte string and its |
509 |
a multibyte string. If @var{ignore-case} is non-@code{nil}, then case |
conversion to multibyte are always regarded as equal. If |
510 |
is ignored, so that upper case letters can be equal to lower case letters. |
@var{ignore-case} is non-@code{nil}, then case is ignored, so that |
511 |
|
upper case letters can be equal to lower case letters. |
512 |
|
|
513 |
If the specified portions of the two strings match, the value is |
If the specified portions of the two strings match, the value is |
514 |
@code{t}. Otherwise, the value is an integer which indicates how many |
@code{t}. Otherwise, the value is an integer which indicates how many |
519 |
@end defun |
@end defun |
520 |
|
|
521 |
@defun assoc-ignore-case key alist |
@defun assoc-ignore-case key alist |
522 |
This function works like @code{assoc}, except that @var{key} must be a |
@defunx assoc-ignore-representation key alist |
523 |
string, and comparison is done using @code{compare-strings}, ignoring |
These functions work like @code{assoc}, except that @var{key} must be |
524 |
case differences. @xref{Association Lists}. |
a string, all elements of @var{alist} must be cons cells whose |
525 |
@end defun |
@sc{car} is a string, and comparison is done using |
526 |
|
@code{compare-strings}. @code{assoc-ignore-case} ignores case |
527 |
@defun assoc-ignore-representation key alist |
differences, whereas @code{assoc-ignore-representation} does not. |
528 |
This function works like @code{assoc}, except that @var{key} must be a |
@xref{Association Lists}. |
|
string, and comparison is done using @code{compare-strings}. |
|
|
Case differences are significant. |
|
529 |
@end defun |
@end defun |
530 |
|
|
531 |
See also @code{compare-buffer-substrings} in @ref{Comparing Text}, for |
See also @code{compare-buffer-substrings} in @ref{Comparing Text}, for |