Swift (3) Character and String
1、Initializing an Empty String var emtyString = “” var anotherEmptyString = String() 两种初始化方法 2、Find out whether a String value is empty by checking its Boolean isEmpty property if emptyString.isEmpy { print(“Nothing to see here”) } 3、override 计算机里面是覆盖的意思 4、变量能修改,常量不能修改,这个与oc里面的字符串不一样
6、you can create a stand-alone Character constant or variable from a single-character string literal by providing a Character type annotation. 你能通过一个简单的字符字符串文字,创建一个创建一个独立的字符常量或者变量。不过需要提供一个字符类型注释。 7、注意:字符类型和字符串类型是两种不同的类型。 Character value must contain a single character only 8、String values can be constructed by passing an array of Character values as an argument to its initializer. 字符串值能通过一个字符数组作为它的参数来构造。 let catCharacters:[Character] = [“C”,”a”,”t”,”!”,”?”] let catString = String(catCharacters) print(catString) 9、Concatenating Strings and Characters构建字符串和字符 其中之一:you can append a Character value to a String type’s append() method: welcome = “Hello there” let exclamationMark: Character = “!” welcome.append(exclamationMark) print ——>result :”hello there” 10、Unicode Unicode is an international standard for encoding,representing,and processing text in different writing systems. Unicode是一种国际上的编码标准,用不同的书写系统代表和处理text。 又称呼万国码,是计算机科学领域里的一项业界标准。它对世界大部分的文字系统进行了整理、编码,使得电脑可以用更为简单的方式来呈现和处理文字。Uni—>universal通用的 11、Unicode Scalars Unicode的标量 A Unicode scalar is a unique 21-bit number for a character or modifier A Unicode 标量是一个21比特的数字 A Unicode scalars is any Unicode code point in the range U+0000 to U+D7FF inclusive or U+E000 to U+10FFFF inclusive.Unicode scalars do not include the Unicode surrogate pair code points,which are the code points in the range U+D800 to U+DFFF inclusive. A Unicode scalars 在范围U+0000 到U+D7FF 或者U+E000 到U+10FFFF. Unicode scalars do not include the Unicode surrogate pair code points,which are the code points in the range U+D800 to U+DFFF inclusive surrogate 代理 surrogate pair code points是什么??????? 注意都是以U开头 12、The escaped special characters 转义的特殊字符 |