This document provides an overview of strings and string handling in Swift. It discusses strings as collections of characters, encoding of strings in UTF-8, UTF-16 and UTF-32, properties of String and NSString like count and indexing, comparing strings using == and isEqual(to:), and considerations for equality of strings across encodings and decomposed character representations.
37. "e" == "e"
lhs rhs
Character
e
U+0065
e
U+0065
UnicodeScalar
(UTF-32)
e
U+0065
e
U+0065
D?
(NFD)
U+0065 U+0065
Swift
==
true
NSString?
isEqual:
YES
38. "" == "e" + "?"
lhs rhs
Character
U+00E9
U+0065 U+0301
UnicodeScalar
(UTF-32)
U+00E9
e
U+0065
?
U+0301
D?
(NFD)
e
U+0065
?
U+0301
e
U+0065
?
U+0301
Swift
==
true
NSString?
isEqual:
NO