{"id":53012,"date":"2024-12-03T17:57:34","date_gmt":"2024-12-03T09:57:34","guid":{"rendered":"https:\/\/fwq.ai\/blog\/53012\/"},"modified":"2024-12-03T17:57:34","modified_gmt":"2024-12-03T09:57:34","slug":"%e8%8b%b1%e6%96%87%e6%a0%87%e9%a2%98%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0%e5%8d%95%e8%af%8d%e9%a6%96%e5%ad%97%e6%af%8d%e5%a4%a7%e5%86%99%ef%bc%9f-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/53012\/","title":{"rendered":"\u82f1\u6587\u6807\u9898\u5982\u4f55\u5b9e\u73b0\u5355\u8bcd\u9996\u5b57\u6bcd\u5927\u5199\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u82f1\u6587\u6807\u9898\u5982\u4f55\u5b9e\u73b0\u5355\u8bcd\u9996\u5b57\u6bcd\u5927\u5199\uff1f<\/h1>\n<p>\u79ef\u7d2f\u77e5\u8bc6\uff0c\u80dc\u8fc7\u79ef\u84c4\u91d1\u94f6\uff01\u6bd5\u7adf\u5728\u6587\u7ae0\u5f00\u53d1\u7684\u8fc7\u7a0b\u4e2d\uff0c\u4f1a\u9047\u5230\u5404\u79cd\u5404\u6837\u7684\u95ee\u9898\uff0c\u5f80\u5f80\u90fd\u662f\u4e00\u4e9b\u7ec6\u8282\u77e5\u8bc6\u70b9\u8fd8\u6ca1\u6709\u638c\u63e1\u597d\u800c\u5bfc\u81f4\u7684\uff0c\u56e0\u6b64\u57fa\u7840\u77e5\u8bc6\u70b9\u7684\u79ef\u7d2f\u662f\u5f88\u91cd\u8981\u7684\u3002\u4e0b\u9762\u672c\u6587\u300a\u82f1\u6587\u6807\u9898\u5982\u4f55\u5b9e\u73b0\u5355\u8bcd\u9996\u5b57\u6bcd\u5927\u5199\uff1f\u300b\uff0c\u5c31\u5e26\u5927\u5bb6\u8bb2\u89e3\u4e00\u4e0b\u77e5\u8bc6\u70b9\uff0c\u82e5\u662f\u4f60\u5bf9\u672c\u6587\u611f\u5174\u8da3\uff0c\u6216\u8005\u662f\u60f3\u641e\u61c2\u5176\u4e2d\u67d0\u4e2a\u77e5\u8bc6\u70b9\uff0c\u5c31\u8bf7\u4f60\u7ee7\u7eed\u5f80\u4e0b\u770b\u5427~<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241125\/1732527586674445e284f63.jpg\" class=\"aligncenter\" title=\"\u82f1\u6587\u6807\u9898\u5982\u4f55\u5b9e\u73b0\u5355\u8bcd\u9996\u5b57\u6bcd\u5927\u5199\uff1f\u63d2\u56fe\" alt=\"\u82f1\u6587\u6807\u9898\u5982\u4f55\u5b9e\u73b0\u5355\u8bcd\u9996\u5b57\u6bcd\u5927\u5199\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728\u82f1\u6587\u6807\u9898\u4e2d\u5b9e\u73b0\u5355\u8bcd\u9996\u5b57\u6bcd\u5927\u5199\uff1f<\/strong><\/p>\n<p>\u4e2d\u6587\u7ffb\u8bd1\u540e\u7684\u82f1\u6587\u5355\u8bcd\u901a\u5e38\u4e0d\u5e26\u5927\u5c0f\u5199\uff0c\u4f46\u5728\u6807\u9898\u4e2d\u9700\u8981\u5c06\u5176\u9996\u5b57\u6bcd\u5927\u5199\u3002\u4f8b\u5982\uff0c\u201chelp and feedback\u201d\u5e94\u6539\u4e3a\u201chelp and feedback\u201d\uff0c\u5176\u4e2d\u201chelp\u201d\u548c\u201cfeedback\u201d\u9996\u5b57\u6bcd\u5927\u5199\u3002<\/p>\n<p>\u4f20\u7edf\u7684 text-transform: capitalize \u65e0\u6cd5\u6ee1\u8db3\u8fd9\u4e2a\u9700\u6c42\uff0c\u56e0\u4e3a\u5b83\u4f1a\u5c06\u6240\u6709\u5355\u8bcd\u7684\u9996\u5b57\u6bcd\u90fd\u5927\u5199\uff0c\u5305\u62ec\u201cand\u201d\u7b49\u4e0d\u5e94\u8be5\u5927\u5199\u7684\u5355\u8bcd\u3002<\/p>\n<p>\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff1a<\/p>\n<pre>function capitalizeFirstLetter(str) {\n    const smallWords = ['of', 'the', 'and', 'an', 'a', 'in'];\n    return str.split(' ').map((word, index) =&gt; {\n        if (index === 0 || !smallWords.includes(word.toLowerCase())) {\n            return word.charAt(0).toUpperCase() + word.slice(1);\n        } else {\n            return word;\n        }\n    }).join(' ');\n}<\/pre>\n<p>\u8be5\u51fd\u6570\u5c06\u5b57\u7b26\u4e32\u62c6\u5206\u4e3a\u5355\u8bcd\uff0c\u7136\u540e\u9010\u4e2a\u68c0\u67e5\u6bcf\u4e2a\u5355\u8bcd\u3002<\/p>\n<ul>\n<li>\u5982\u679c\u5b83\u662f\u6807\u9898\u7684\u7b2c\u4e00\u4e2a\u5355\u8bcd\uff0c\u6216\u8005\u5b83\u4e0d\u5728\u9884\u5b9a\u4e49\u7684\u65e0\u9700\u5927\u5199\u7684\u5355\u8bcd\u5217\u8868\u4e2d\uff08\u4f8b\u5982\u201cof\u201d\u3001\u201cthe\u201d\u3001\u201cand\u201d\u7b49\uff09\uff0c\u5219\u5c06\u5176\u9996\u5b57\u6bcd\u5927\u5199\u3002<\/li>\n<li>\u5426\u5219\uff0c\u4fdd\u6301\u5355\u8bcd\u539f\u6837\u3002<\/li>\n<\/ul>\n<p>\u6700\u540e\uff0c\u51fd\u6570\u5c06\u5927\u5199\u540e\u7684\u5355\u8bcd\u91cd\u65b0\u7ec4\u5408\u6210\u4e00\u4e2a\u6807\u9898\u5316\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n<p>\u672c\u7bc7\u5173\u4e8e\u300a\u82f1\u6587\u6807\u9898\u5982\u4f55\u5b9e\u73b0\u5355\u8bcd\u9996\u5b57\u6bcd\u5927\u5199\uff1f\u300b\u7684\u4ecb\u7ecd\u5c31\u5230\u6b64\u7ed3\u675f\u5566\uff0c\u4f46\u662f\u5b66\u65e0\u6b62\u5883\uff0c\u60f3\u8981\u4e86\u89e3\u5b66\u4e60\u66f4\u591a\u5173\u4e8e\u6587\u7ae0\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   Python \u5feb\u901f\u6392\u5e8f\uff1a\u5982\u4f55\u968f\u673a\u9009\u53d6\u6bcf\u6b21\u6392\u5e8f\u7684\u57fa\u503c\uff1f\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u82f1\u6587\u6807\u9898\u5982\u4f55\u5b9e\u73b0\u5355\u8bcd\u9996\u5b57\u6bcd\u5927\u5199\uff1f \u79ef\u7d2f\u77e5\u8bc6\uff0c\u80dc\u8fc7\u79ef\u84c4\u91d1\u94f6\uff01\u6bd5\u7adf\u5728\u6587\u7ae0\u5f00\u53d1\u7684\u8fc7\u7a0b\u4e2d\uff0c\u4f1a\u9047\u5230\u5404\u79cd\u5404\u6837\u7684\u95ee\u9898\uff0c\u5f80\u5f80\u90fd\u662f\u4e00\u4e9b\u7ec6\u8282\u77e5\u8bc6\u70b9\u8fd8\u6ca1\u6709\u638c\u63e1\u597d\u800c\u5bfc\u81f4\u7684\uff0c\u56e0\u6b64\u57fa\u7840\u77e5\u8bc6\u70b9\u7684\u79ef\u7d2f\u662f\u5f88\u91cd\u8981\u7684\u3002\u4e0b\u9762\u672c\u6587\u300a\u82f1\u6587\u6807\u9898\u5982\u4f55\u5b9e\u73b0\u5355\u8bcd\u9996\u5b57\u6bcd\u5927\u5199\uff1f\u300b\uff0c\u5c31\u5e26\u5927\u5bb6\u8bb2\u89e3\u4e00\u4e0b\u77e5\u8bc6\u70b9\uff0c\u82e5\u662f\u4f60\u5bf9\u672c\u6587\u611f\u5174\u8da3\uff0c\u6216\u8005\u662f\u60f3\u641e\u61c2\u5176\u4e2d\u67d0\u4e2a\u77e5\u8bc6\u70b9\uff0c\u5c31\u8bf7\u4f60\u7ee7\u7eed\u5f80\u4e0b\u770b\u5427~ \u5982\u4f55\u5728\u82f1\u6587\u6807\u9898\u4e2d\u5b9e\u73b0\u5355\u8bcd\u9996\u5b57\u6bcd\u5927\u5199\uff1f \u4e2d\u6587\u7ffb\u8bd1\u540e\u7684\u82f1\u6587\u5355\u8bcd\u901a\u5e38\u4e0d\u5e26\u5927\u5c0f\u5199\uff0c\u4f46\u5728\u6807\u9898\u4e2d\u9700\u8981\u5c06\u5176\u9996\u5b57\u6bcd\u5927\u5199\u3002\u4f8b\u5982\uff0c\u201chelp and feedback\u201d\u5e94\u6539\u4e3a\u201chelp and feedback\u201d\uff0c\u5176\u4e2d\u201chelp\u201d\u548c\u201cfeedback\u201d\u9996\u5b57\u6bcd\u5927\u5199\u3002 \u4f20\u7edf\u7684 text-transform: capitalize \u65e0\u6cd5\u6ee1\u8db3\u8fd9\u4e2a\u9700\u6c42\uff0c\u56e0\u4e3a\u5b83\u4f1a\u5c06\u6240\u6709\u5355\u8bcd\u7684\u9996\u5b57\u6bcd\u90fd\u5927\u5199\uff0c\u5305\u62ec\u201cand\u201d\u7b49\u4e0d\u5e94\u8be5\u5927\u5199\u7684\u5355\u8bcd\u3002 \u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff1a function capitalizeFirstLetter(str) { const smallWords = [&#8216;of&#8217;, &#8216;the&#8217;, &#8216;and&#8217;, &#8216;an&#8217;, &#8216;a&#8217;, &#8216;in&#8217;]; return str.split(&#8216; &#8216;).map((word, index) =&gt; { if (index === 0 || !smallWords.includes(word.toLowerCase())) { return word.charAt(0).toUpperCase() + word.slice(1); } else { return word; } }).join(&#8216; &#8216;); } \u8be5\u51fd\u6570\u5c06\u5b57\u7b26\u4e32\u62c6\u5206\u4e3a\u5355\u8bcd\uff0c\u7136\u540e\u9010\u4e2a\u68c0\u67e5\u6bcf\u4e2a\u5355\u8bcd\u3002 \u5982\u679c\u5b83\u662f\u6807\u9898\u7684\u7b2c\u4e00\u4e2a\u5355\u8bcd\uff0c\u6216\u8005\u5b83\u4e0d\u5728\u9884\u5b9a\u4e49\u7684\u65e0\u9700\u5927\u5199\u7684\u5355\u8bcd\u5217\u8868\u4e2d\uff08\u4f8b\u5982\u201cof\u201d\u3001\u201cthe\u201d\u3001\u201cand\u201d\u7b49\uff09\uff0c\u5219\u5c06\u5176\u9996\u5b57\u6bcd\u5927\u5199\u3002 \u5426\u5219\uff0c\u4fdd\u6301\u5355\u8bcd\u539f\u6837\u3002 \u6700\u540e\uff0c\u51fd\u6570\u5c06\u5927\u5199\u540e\u7684\u5355\u8bcd\u91cd\u65b0\u7ec4\u5408\u6210\u4e00\u4e2a\u6807\u9898\u5316\u7684\u5b57\u7b26\u4e32\u3002 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-53012","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53012","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=53012"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53012\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=53012"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=53012"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=53012"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}