Chapter 9, equal = false

Within the book it said equal is true, because the two string are logically the same
why when I test on xcode playground the value of equal is false

let cafeNormal = "cafè"
let cafeCombining = "cafe\u{0301}"
let equal = cafeNormal == cafeCombining

You have the wrong accented e in cafeNormal. Inside cafeCombining you specified the unicode codepoint \u0301, which is called a combining acute accent, and the accent points up and to the right: ́. On the other hand, the accent on your e in cafeNormal points up and to the left, which is called a grave accent. You need to put an e in cafeNormal whose unicode code point is U+00E9, and which looks like this: é.

é   -- \u{0301} combined with e  (LATIN SMALL LETTER E WITH ACUTE)

Ok I feel dumb, lesson learned…
Thanks 7stud

This topic was automatically closed after 166 days. New replies are no longer allowed.