{"id":44217,"date":"2022-12-15T20:26:26","date_gmt":"2022-08-05T13:48:18","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8go%e8%af%ad%e8%a8%80%e8%bf%9b%e8%a1%8c%e9%9b%b6%e5%a1%ab%e5%85%85\/"},"modified":"2024-01-15T11:57:48","modified_gmt":"2024-01-15T03:57:48","slug":"%e7%94%a8go%e8%af%ad%e8%a8%80%e8%bf%9b%e8%a1%8c%e9%9b%b6%e5%a1%ab%e5%85%85","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8go%e8%af%ad%e8%a8%80%e8%bf%9b%e8%a1%8c%e9%9b%b6%e5%a1%ab%e5%85%85\/","title":{"rendered":"\u7528Go\u8bed\u8a00\u8fdb\u884c\u96f6\u586b\u5145"},"content":{"rendered":"<h1>\u4f7f\u7528Golang\u8fdb\u884c\u96f6\u586b\u5145<\/h1>\n<p>\u5f53\u6570\u5b57\u4e3a0~9\u65f6\uff0c\u5728\u6570\u5b57\u524d\u9762\u52a0\u4e0a0\uff1b<br \/>\n\u5f53\u6570\u5b57\u4e3a10\u53ca\u4ee5\u4e0a\u65f6\uff0c\u4e0d\u9700\u8981\u52a0\u4e0a0\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5982\u4e0b\uff1a<\/p>\n<pre class=\"post-pre\"><code>s := 3\r\nstr := fmt.Sprintf(\"%02d\", s)\r\nfmt.Println(str)\r\n\/\/ 03\r\n\r\ns2 := 13\r\nstr2 := fmt.Sprintf(\"%02d\", s2)\r\nfmt.Println(str2)\r\n\/\/ 13\r\n<\/code><\/pre>\n<p>\u5f53\u6211\u77e5\u9053\u4ee5\u4ee5\u4e0b\u7e41\u7410\u7684\u65b9\u5f0f\u5b9e\u73b0\u540e\u611f\u5230\u9707\u60ca\uff0c\u56e0\u5176\u4e0d\u77e5\u9053\u7684\u539f\u56e0&#8230;<\/p>\n<pre class=\"post-pre\"><code>if num &lt; 10 {\r\n\u200b\r\n    numStr = \"0\" + strconv.Itoa(num)\r\n\u200b\r\n} else {\r\n\u200b\r\n    numStr = strconv.Itoa(num)\r\n\u200b\r\n}\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528Golang\u8fdb\u884c\u96f6\u586b\u5145 \u5f53\u6570\u5b57\u4e3a0~9\u65f6\uff0c\u5728\u6570\u5b57\u524d\u9762\u52a0\u4e0a0\uff1b \u5f53\u6570\u5b57\u4e3a10\u53ca\u4ee5\u4e0a\u65f6\uff0c\u4e0d\u9700\u8981\u52a0\u4e0a0\uff0c\u53ef\u4ee5\u5b9e\u73b0 [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-44217","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u7528Go\u8bed\u8a00\u8fdb\u884c\u96f6\u586b\u5145 - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u7528go\u8bed\u8a00\u8fdb\u884c\u96f6\u586b\u5145\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u7528Go\u8bed\u8a00\u8fdb\u884c\u96f6\u586b\u5145\" \/>\n<meta property=\"og:description\" content=\"\u4f7f\u7528Golang\u8fdb\u884c\u96f6\u586b\u5145 \u5f53\u6570\u5b57\u4e3a0~9\u65f6\uff0c\u5728\u6570\u5b57\u524d\u9762\u52a0\u4e0a0\uff1b \u5f53\u6570\u5b57\u4e3a10\u53ca\u4ee5\u4e0a\u65f6\uff0c\u4e0d\u9700\u8981\u52a0\u4e0a0\uff0c\u53ef\u4ee5\u5b9e\u73b0 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u7528go\u8bed\u8a00\u8fdb\u884c\u96f6\u586b\u5145\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-05T13:48:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-15T03:57:48+00:00\" \/>\n<meta name=\"author\" content=\"\u6e05, \u5b87\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u6e05, \u5b87\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8go%e8%af%ad%e8%a8%80%e8%bf%9b%e8%a1%8c%e9%9b%b6%e5%a1%ab%e5%85%85\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8go%e8%af%ad%e8%a8%80%e8%bf%9b%e8%a1%8c%e9%9b%b6%e5%a1%ab%e5%85%85\/\",\"name\":\"\u7528Go\u8bed\u8a00\u8fdb\u884c\u96f6\u586b\u5145 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2022-08-05T13:48:18+00:00\",\"dateModified\":\"2024-01-15T03:57:48+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8go%e8%af%ad%e8%a8%80%e8%bf%9b%e8%a1%8c%e9%9b%b6%e5%a1%ab%e5%85%85\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8go%e8%af%ad%e8%a8%80%e8%bf%9b%e8%a1%8c%e9%9b%b6%e5%a1%ab%e5%85%85\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8go%e8%af%ad%e8%a8%80%e8%bf%9b%e8%a1%8c%e9%9b%b6%e5%a1%ab%e5%85%85\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u7528Go\u8bed\u8a00\u8fdb\u884c\u96f6\u586b\u5145\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e\",\"name\":\"\u6e05, \u5b87\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g\",\"caption\":\"\u6e05, \u5b87\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/qingyu\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8go%e8%af%ad%e8%a8%80%e8%bf%9b%e8%a1%8c%e9%9b%b6%e5%a1%ab%e5%85%85\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u7528Go\u8bed\u8a00\u8fdb\u884c\u96f6\u586b\u5145 - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u7528go\u8bed\u8a00\u8fdb\u884c\u96f6\u586b\u5145\/","og_locale":"zh_CN","og_type":"article","og_title":"\u7528Go\u8bed\u8a00\u8fdb\u884c\u96f6\u586b\u5145","og_description":"\u4f7f\u7528Golang\u8fdb\u884c\u96f6\u586b\u5145 \u5f53\u6570\u5b57\u4e3a0~9\u65f6\uff0c\u5728\u6570\u5b57\u524d\u9762\u52a0\u4e0a0\uff1b \u5f53\u6570\u5b57\u4e3a10\u53ca\u4ee5\u4e0a\u65f6\uff0c\u4e0d\u9700\u8981\u52a0\u4e0a0\uff0c\u53ef\u4ee5\u5b9e\u73b0 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u7528go\u8bed\u8a00\u8fdb\u884c\u96f6\u586b\u5145\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2022-08-05T13:48:18+00:00","article_modified_time":"2024-01-15T03:57:48+00:00","author":"\u6e05, \u5b87","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u6e05, \u5b87"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8go%e8%af%ad%e8%a8%80%e8%bf%9b%e8%a1%8c%e9%9b%b6%e5%a1%ab%e5%85%85\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8go%e8%af%ad%e8%a8%80%e8%bf%9b%e8%a1%8c%e9%9b%b6%e5%a1%ab%e5%85%85\/","name":"\u7528Go\u8bed\u8a00\u8fdb\u884c\u96f6\u586b\u5145 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2022-08-05T13:48:18+00:00","dateModified":"2024-01-15T03:57:48+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8go%e8%af%ad%e8%a8%80%e8%bf%9b%e8%a1%8c%e9%9b%b6%e5%a1%ab%e5%85%85\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8go%e8%af%ad%e8%a8%80%e8%bf%9b%e8%a1%8c%e9%9b%b6%e5%a1%ab%e5%85%85\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8go%e8%af%ad%e8%a8%80%e8%bf%9b%e8%a1%8c%e9%9b%b6%e5%a1%ab%e5%85%85\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u7528Go\u8bed\u8a00\u8fdb\u884c\u96f6\u586b\u5145"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e","name":"\u6e05, \u5b87","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g","caption":"\u6e05, \u5b87"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/qingyu\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e7%94%a8go%e8%af%ad%e8%a8%80%e8%bf%9b%e8%a1%8c%e9%9b%b6%e5%a1%ab%e5%85%85\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/44217","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=44217"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/44217\/revisions"}],"predecessor-version":[{"id":59259,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/44217\/revisions\/59259"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=44217"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=44217"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=44217"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}