@node Text Props and Strings
@subsubsection Text Properties in Strings
+@cindex @samp{#(} read syntax
+@cindex text properties, read syntax
A string can hold properties for the characters it contains, in
addition to the characters themselves. This enables programs that copy
text between strings and buffers to copy the text's properties with no
@section Equality Predicates
@cindex equality
- Here we describe two functions that test for equality between any two
+ Here we describe functions that test for equality between any two
objects. Other functions test equality of contents between objects of specific
types, e.g., strings. For these predicates, see the appropriate chapter
describing the data type.
@end example
Comparison of strings is case-sensitive, but does not take account of
-text properties---it compares only the characters in the strings. For
+text properties---it compares only the characters in the strings. Use
+@code{equal-including-properties} to also compare text properties. For
technical reasons, a unibyte string and a multibyte string are
@code{equal} if and only if they contain the same sequence of
character codes and all these codes are either in the range 0 through
Because of this recursive method, circular lists may therefore cause
infinite recursion (leading to an error).
+@defun equal-including-properties object1 object2
+This function behaves like @code{equal} in all cases but also requires
+that for two strings to be equal, they have the same text properties.
+
+@example
+@group
+(equal "asdf" (propertize "asdf" '(asdf t)))
+ @result{} t
+@end group
+@group
+(equal-including-properties "asdf"
+ (propertize "asdf" '(asdf t)))
+ @result{} nil
+@end group
+@end example
+@end defun
+
@ignore
arch-tag: 9711a66e-4749-4265-9e8c-972d55b67096
@end ignore