Chapter 4: Strings

*Unicode. It defines the character set mapping that almost all computers use today.

The number associated with each character is called a code point.


*The Character data type can store a single character. For example:

let characterA: Character = "a"


*Interpolation is a special Swift syntax that lets you build a string in a way that's easy to read:

let name1 = "Matt"

let message1 = "Hello my name is \(name)!" // "Hello my name is Matt!"


*You saw the single character, code point 233, earlier in this chapter. The two-character case is an e on its own followed by an acute accent combining character, which is a special characters that modifies the previous character.

In Swift, you can compare strings using the standard equality operator, ==, inexactly the same way as you compare numbers.

The combination of these two characters in the second diagram forms what is known as a grapheme cluster.

It doesn't matter which way it does the canonicalization--using the single character or using the combining character--as long as both strings get converted to the same style. Once the canonicalization is complete, Swift can compare individual characters to check for equality. 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值