{"id":2539,"date":"2015-11-21T23:41:10","date_gmt":"2015-11-21T15:41:10","guid":{"rendered":"http:\/\/ixyzero.com\/blog\/?p=2539"},"modified":"2015-11-21T23:41:10","modified_gmt":"2015-11-21T15:41:10","slug":"go%e8%af%ad%e8%a8%80%e4%b8%ad%e7%9a%84%e5%8d%95%e5%bc%95%e5%8f%b7%e3%80%81%e5%8f%8c%e5%bc%95%e5%8f%b7%e3%80%81%e5%8f%8d%e5%bc%95%e5%8f%b7","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/2539.html","title":{"rendered":"Go\u8bed\u8a00\u4e2d\u7684\u5355\u5f15\u53f7\u3001\u53cc\u5f15\u53f7\u3001\u53cd\u5f15\u53f7"},"content":{"rendered":"<p>=Start=<\/p>\n<h6>\u641c\u7d22\u5173\u952e\u5b57\uff1a<\/h6>\n<p>golang\u00a0single quotes<br \/>\ngolang double quotes<br \/>\ngolang back quotes<\/p>\n<h6>\u53c2\u8003\u7ed3\u679c\uff1a<\/h6>\n<p>\u7ed3\u8bba\u5199\u5728\u6700\u524d\uff1a\u5728Go\u8bed\u8a00\u4e2d\u4e0d\u503e\u5411\u4e8e\u4f7f\u7528\u5355\u5f15\u53f7\u6765\u8868\u793a\u5b57\u7b26\u4e32\uff0c\u8bf7\u6839\u636e\u9700\u8981\u4f7f\u7528\u53cc\u5f15\u53f7\u6216\u53cd\u5f15\u53f7\u3002<\/p>\n<hr \/>\n<p>\u4e00\u4e2aGo\u8bed\u8a00\u5b57\u7b26\u4e32\u662f\u4e00\u4e2a\u4efb\u610f\u5b57\u8282\u7684\u5e38\u91cf\u5e8f\u5217\u3002Go\u8bed\u8a00\u7684\u5b57\u7b26\u4e32\u7c7b\u578b\u5728\u672c\u8d28\u4e0a\u5c31\u4e0e\u5176\u4ed6\u8bed\u8a00\u7684\u5b57\u7b26\u4e32\u7c7b\u578b\u4e0d\u540c\u3002Java\u7684String\u3001C++\u7684std::string\u4ee5\u53caPython3\u7684str\u7c7b\u578b\u90fd\u53ea\u662f\u5b9a\u5bbd\u5b57\u7b26\u5e8f\u5217\uff0c\u800c<span style=\"color: #0000ff;\"><strong>Go\u8bed\u8a00\u7684\u5b57\u7b26\u4e32\u662f\u4e00\u4e2a\u7528UTF-8\u7f16\u7801\u7684\u53d8\u5bbd\u5b57\u7b26\u5e8f\u5217\uff0c\u5b83\u7684\u6bcf\u4e00\u4e2a\u5b57\u7b26\u90fd\u7528\u4e00\u4e2a\u6216\u591a\u4e2a\u5b57\u8282\u8868\u793a<\/strong><\/span>\u3002<\/p>\n<p><span style=\"color: #ff0000;\"><strong>Go\u8bed\u8a00\u4e2d\u7684\u5b57\u7b26\u4e32\u5b57\u9762\u91cf\u4f7f\u7528 \u53cc\u5f15\u53f7 \u6216 \u53cd\u5f15\u53f7 \u6765\u521b\u5efa<\/strong><\/span>\uff1a<\/p>\n<ul>\n<li>\u53cc\u5f15\u53f7\u7528\u6765\u521b\u5efa<strong><span style=\"color: #ff0000;\">\u53ef\u89e3\u6790\u7684\u5b57\u7b26\u4e32\u5b57\u9762\u91cf<\/span><\/strong>(\u652f\u6301\u8f6c\u4e49\uff0c\u4f46\u4e0d\u80fd\u7528\u6765\u5f15\u7528\u591a\u884c)\uff1b<\/li>\n<li>\u53cd\u5f15\u53f7\u7528\u6765\u521b\u5efa<strong><span style=\"color: #ff0000;\">\u539f\u751f\u7684\u5b57\u7b26\u4e32\u5b57\u9762\u91cf<\/span><\/strong>\uff0c\u8fd9\u4e9b\u5b57\u7b26\u4e32\u53ef\u80fd\u7531\u591a\u884c\u7ec4\u6210(\u4e0d\u652f\u6301\u4efb\u4f55\u8f6c\u4e49\u5e8f\u5217)\uff0c\u539f\u751f\u7684\u5b57\u7b26\u4e32\u5b57\u9762\u91cf\u591a\u7528\u4e8e\u4e66\u5199\u591a\u884c\u6d88\u606f\u3001HTML\u4ee5\u53ca\u6b63\u5219\u8868\u8fbe\u5f0f\u3002<\/li>\n<\/ul>\n<hr \/>\n<blockquote><p>There are two forms: raw string literals and interpreted string literals.<\/p>\n<ul>\n<li>Raw string literals are character sequences between back quotes, as in `foo`.<\/li>\n<li>Interpreted string literals are character sequences between double quotes, as in &#8220;bar&#8221;.<\/li>\n<\/ul>\n<p>A rune literal represents a rune constant, an integer value identifying a Unicode code point. A rune literal is expressed as one or more characters enclosed in single quotes, as in &#8216;x&#8217; or &#8216;\\n&#8217;. Within the quotes, any character may appear except newline and unescaped single quote. A single quoted character represents the Unicode value of the character itself, while multi-character sequences beginning with a backslash encode values in various formats.<\/p><\/blockquote>\n<p>=<\/p>\n<p>\u6839\u636e\u6211\u627e\u5230\u7684\u8d44\u6599\u4ee5\u53ca\u78b0\u5230\u7684\u60c5\u51b5\u6765\u770b\uff0c<strong><span style=\"color: #ff0000;\">Go\u8bed\u8a00\u7684\u5355\u5f15\u53f7\u4e00\u822c\u7528\u6765\u8868\u793a\u300crune literal\u300d<\/span><\/strong>\uff0c\u5373\u2014\u2014\u7801\u70b9\u5b57\u9762\u91cf\u3002<\/p>\n<h6>\u53c2\u8003\u94fe\u63a5\uff1a<\/h6>\n<ul>\n<li><a href=\"https:\/\/golang.org\/ref\/spec#String_literals\" target=\"_blank\">https:\/\/golang.org\/ref\/spec#String_literals<\/a><\/li>\n<li><a href=\"https:\/\/golang.org\/ref\/spec#Rune_literals\" target=\"_blank\">https:\/\/golang.org\/ref\/spec#Rune_literals<\/a><\/li>\n<li><a href=\"http:\/\/teapottable.com\/blog\/starting-out-with-go-lang\/\" target=\"_blank\">http:\/\/teapottable.com\/blog\/starting-out-with-go-lang\/<\/a><\/li>\n<\/ul>\n<p>=EOF=<\/p>\n","protected":false},"excerpt":{"rendered":"<p>=Start= \u641c\u7d22\u5173\u952e\u5b57\uff1a golang\u00a0single quotes golang double quote [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,7],"tags":[563,564,570],"class_list":["post-2539","post","type-post","status-publish","format-standard","hentry","category-knowledgebase-2","category-programing","tag-go","tag-golang","tag-570"],"views":3801,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/2539","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=2539"}],"version-history":[{"count":0,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/2539\/revisions"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=2539"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=2539"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=2539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}