- 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:

- Flask Web全棧開發實戰
- 圖解Java數據結構與算法(微課視頻版)
- 深入淺出Spring Boot 2.x
- Raspberry Pi for Secret Agents(Third Edition)
- Learning Laravel 4 Application Development
- 零基礎入門學習Python
- 小學生C++創意編程(視頻教學版)
- Python Interviews
- Building Dynamics CRM 2015 Dashboards with Power BI
- Android高級開發實戰:UI、NDK與安全
- 軟硬件綜合系統軟件需求建模及可靠性綜合試驗、分析、評價技術
- Clojure Data Structures and Algorithms Cookbook
- 生成藝術:Processing視覺創意入門
- Java EE框架開發技術與案例教程
- Getting Started with SQL Server 2014 Administration