Returns a Boolean value that indicates whether a given string is equal to the receiver using a literal Unicode-based comparison.
- iOS 2.0+
- macOS 10.0+
- tvOS 9.0+
- watchOS 2.0+
The string with which to compare the receiver.
The comparison uses the canonical representation of strings, which for a particular string is the length of the string plus the UTF-16 code units that make up the string. When this method compares two strings, if the individual Unicodes are the same, then the strings are equal, regardless of the backing store. “Literal” when applied to string comparison means that various Unicode decomposition rules are not applied and UTF-16 code units are individually compared. So, for instance, “Ö” represented as the composed character sequence “O” (
U+004F LATIN CAPITAL LETTER O) and a combining diaeresis “¨” (
U+0308 COMBINING DIAERESIS) would not compare equal to “Ö” represented as a single Unicode character (
U+00D6 LATIN CAPITAL LETTER O WITH DIAERESIS).
When you know both objects are strings, this method is a faster way to check equality than