From c126f4fd88e4a11349e3bbb8d446ad6481b99e26 Mon Sep 17 00:00:00 2001 From: wan jerry Date: Thu, 6 Aug 2015 17:25:27 +0800 Subject: [PATCH] update 03_Strings_and_Characters.md --- source/chapter2/03_Strings_and_Characters.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/chapter2/03_Strings_and_Characters.md b/source/chapter2/03_Strings_and_Characters.md index efb2fff3..0ec0ee94 100755 --- a/source/chapter2/03_Strings_and_Characters.md +++ b/source/chapter2/03_Strings_and_Characters.md @@ -34,7 +34,7 @@ Swift 的`String`和`Character`类型提供了一个快速的,兼容 Unicode 你也可以在常量、变量、字面量和表达式中进行字符串插值操作,这可以帮助你轻松创建用于展示、存储和打印的自定义字符串。 > 注意: -> Swift 的`String`类型与 Foundation `NSString`类进行了无缝桥接。就像 [`AnyObject`类型](./20_Type_Casting.html#anyobject) 中提到的一样,在使用 Cocoa 中的 Foundation 框架时,您可以将创建的任何字符串的值转换成`NSString`,并调用任意的`NSString` API。您也可以在任意要求传入`NSString`实例作为参数的 API 中用`String`类型的值代替。 +> Swift 的`String`类型与 Foundation `NSString`类进行了无缝桥接。就像 [`AnyObject`类型](./19_Type_Casting.html#anyobject) 中提到的一样,在使用 Cocoa 中的 Foundation 框架时,您可以将创建的任何字符串的值转换成`NSString`,并调用任意的`NSString` API。您也可以在任意要求传入`NSString`实例作为参数的 API 中用`String`类型的值代替。 > 更多关于在 Foundation 和 Cocoa 中使用`String`的信息请查看 *[Using Swift with Cocoa and Objective-C](https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/index.html#//apple_ref/doc/uid/TP40014216)*。 @@ -129,9 +129,9 @@ for-in 循环在 [For Loops](./05_Control_Flow.html#for_loops) 中进行了详 另外,通过标明一个`Character`类型并用字符字面量进行赋值,可以建立一个独立的字符常量或变量: ```swift -let exclamationMark: Charater = "!" +let exclamationMark: Character = "!" ``` -字符串可以通过传递一个值类型为`Charater`的数组作为自变量来初始化: +字符串可以通过传递一个值类型为`Character`的数组作为自变量来初始化: ```swift let catCharacters: [Character] = ["C", "a", "t", "!", "🐱"] @@ -429,7 +429,7 @@ if eAcuteQuestion == combinedEAcuteQuestion { // 打印输出 "These two strings are considered equal" ``` -相反,英语中的`LATIN CAPITAL LETTER A`(`U+0401`,或者`A`)不等于俄语中的`CYRILLIC CAPITAL LETTER A`(`U+0410`,或者`A`)。两个字符看着是一样的,但却有不同的语言意义: +相反,英语中的`LATIN CAPITAL LETTER A`(`U+0041`,或者`A`)不等于俄语中的`CYRILLIC CAPITAL LETTER A`(`U+0410`,或者`A`)。两个字符看着是一样的,但却有不同的语言意义: ```swift let latinCapitalLetterA: Character = "\u{41}" @@ -531,7 +531,7 @@ let dogString = "Dog‼🐶" D
U+0044 o
U+006F g
U+0067 - ‼
U+1F436 + ‼
U+203C 🐶
U+1F436 @@ -588,7 +588,7 @@ print("\n") D
U+0044 o
U+006F g
U+0067 - ‼
U+1F436 + ‼
U+203C 🐶
U+1F436 @@ -643,7 +643,7 @@ print("\n") D
U+0044 o
U+006F g
U+0067 - ‼
U+1F436 + ‼
U+203C 🐶
U+1F436