\u904d\u5386\u5b57\u7b26\u4e32\u4e2d\u7684\u5b57\u7b26<\/strong><\/div>\nSwift \u7684 String \u7c7b\u578b\u8868\u793a\u7279\u5b9a\u5e8f\u5217\u7684 Character\uff08\u5b57\u7b26\uff09 \u7c7b\u578b\u503c\u7684\u96c6\u5408\u3002 \u6bcf\u4e00\u4e2a\u5b57\u7b26\u503c\u4ee3\u8868\u4e00\u4e2a Unicode \u5b57\u7b26\u3002<\/p>\n
Swift 3 \u4e2d\u7684 String \u9700\u8981\u901a\u8fc7 characters \u53bb\u8c03\u7528\u7684\u5c5e\u6027\u65b9\u6cd5\uff0c\u5728 Swift 4 \u4e2d\u53ef\u4ee5\u901a\u8fc7 String \u5bf9\u8c61\u672c\u8eab\u76f4\u63a5\u8c03\u7528\uff0c\u4f8b\u5982\uff1a<\/p>\n
Swift 3 \u4e2d\uff1a<\/p>\n
\r\nimport Cocoa\r\n\r\nfor ch in \"Runoob\".characters {\r\n print(ch)\r\n}<\/pre>\nSwift 4 \u4e2d\uff1a<\/p>\n
\r\nimport Cocoa\r\n\r\nfor ch in \"Runoob\" {\r\n print(ch)\r\n}<\/pre>\n\u4ee5\u4e0a\u7a0b\u5e8f\u6267\u884c\u8f93\u51fa\u7ed3\u679c\u4e3a\uff1a<\/p>\n
\r\nR\r\nu\r\nn\r\no\r\no\r\nb<\/pre>\n\u5b57\u7b26\u4e32\u8fde\u63a5\u5b57\u7b26<\/strong><\/div>\n\u4ee5\u4e0b\u5b9e\u4f8b\u6f14\u793a\u4e86\u4f7f\u7528 String \u7684 append() \u65b9\u6cd5\u6765\u5b9e\u73b0\u5b57\u7b26\u4e32\u8fde\u63a5\u5b57\u7b26\uff1a<\/p>\n
\r\nimport Cocoa\r\n\r\nvar varA:String = \"Hello \"\r\nlet varB:Character = \"G\"\r\n\r\nvarA.append( varB )\r\n\r\nprint(\"varC = \\(varA)\")<\/pre>\n\u4ee5\u4e0a\u7a0b\u5e8f\u6267\u884c\u8f93\u51fa\u7ed3\u679c\u4e3a\uff1a<\/p>\n
\r\nvarC = Hello G<\/pre>\n","protected":false},"excerpt":{"rendered":"Swift \u7684\u5b57\u7b26\u662f\u4e00\u4e2a\u5355\u4e00\u7684\u5b57\u7b26\u5b57\u7b26\u4e32\u5b57\u9762\u91cf\uff0c\u6570\u636e\u7c7b\u578b\u4e3a Character\u3002 \u4ee5\u4e0b\u5b9e\u4f8b\u5217\u51fa\u4e86\u4e24\u4e2a\u5b57\u7b26\u5b9e\u4f8b\uff1a […]<\/p>\n","protected":false},"author":1470,"featured_media":175141,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-175214","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/175214","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1470"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=175214"}],"version-history":[{"count":3,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/175214\/revisions"}],"predecessor-version":[{"id":175222,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/175214\/revisions\/175222"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/175141"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=175214"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=175214"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=175214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}