Chapter 9, pag 168

Hi,
at the end of page 168 there is this text:
cafeNormal.unicodeScalars.count // 4
cafeCombining.unicodeScalars.count // 5

In reality in Xcode 9.3.1 I get the result 5 for each expression.

Regards, Damiano

Try creating é by holding option and typing e, then typing e again.
That might be your issue.

Or copy/paste from below if it’s not working:

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

cafeNormal.count       //4
cafeCombining.count    //4 

cafeNormal.unicodeScalars.count     // 4
cafeCombining.unicodeScalars.count  // 5

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