- Reactive Programming with Swift 4
- Navdeep Singh
- 191字
- 2021-06-24 18:57:59
Changed interpretation of grapheme clusters
An additional big advancement is the way String interprets grapheme clusters. Conformity of Unicode 9 gives resolution to this.
The use of extended grapheme clusters for character values in Swift 4 means that concatenation and modification of Strings may cause no affect on a resulting String's character count.
For example, if you append a COMBINING ACUTE ACCENT (U+0301) to the end of the String initialized to "cafe", the resulting String will have a character count of 4, and the fourth character will be "e", not e':
var word = "cafe"
print("total chars in \(word) is \(word.count)")
It prints "total chars in cafe is 4":
word += "\u{301}" // COMBINING ACUTE ACCENT, U+0301
print("totalchars in \(word) is \(word.count)")
It prints "total chars in cafe? is 4", whereas the count would increase by 1 to reflect 5 as a result of print statement earlier.
Similar to Dictionaries, the total number of modifications made to String API can be summed up by the following image:

- DevOps:軟件架構師行動指南
- SPSS數據挖掘與案例分析應用實踐
- 一步一步學Spring Boot 2:微服務項目實戰
- Java EE 6 企業級應用開發教程
- Java高并發核心編程(卷2):多線程、鎖、JMM、JUC、高并發設計模式
- JavaScript+jQuery網頁特效設計任務驅動教程(第2版)
- 從0到1:HTML+CSS快速上手
- Redis Essentials
- 編程數學
- BeagleBone Black Cookbook
- Visual C++開發入行真功夫
- 學習OpenCV 4:基于Python的算法實戰
- Android應用開發深入學習實錄
- Unity Character Animation with Mecanim
- WCF技術剖析(卷1)