{"id":1694,"date":"2024-11-10T11:56:07","date_gmt":"2024-11-10T03:56:07","guid":{"rendered":"https:\/\/fwq.ai\/blog\/1694\/"},"modified":"2024-11-10T11:56:07","modified_gmt":"2024-11-10T03:56:07","slug":"%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0%e8%8b%b1%e6%96%87%e6%a0%87%e9%a2%98%e4%b8%ad%e9%83%a8%e5%88%86%e5%8d%95%e8%af%8d%e9%a6%96%e5%ad%97%e6%af%8d%e5%a4%a7%e5%86%99%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/1694\/","title":{"rendered":"\u5982\u4f55\u5b9e\u73b0\u82f1\u6587\u6807\u9898\u4e2d\u90e8\u5206\u5355\u8bcd\u9996\u5b57\u6bcd\u5927\u5199\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173053710435135.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u5b9e\u73b0\u82f1\u6587\u6807\u9898\u4e2d\u90e8\u5206\u5355\u8bcd\u9996\u5b57\u6bcd\u5927\u5199\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u5b9e\u73b0\u82f1\u6587\u6807\u9898\u4e2d\u90e8\u5206\u5355\u8bcd\u9996\u5b57\u6bcd\u5927\u5199\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u6807\u9898\u5355\u8bcd\u9996\u5b57\u6bcd\u5927\u5199\u5b9e\u73b0<\/strong><\/p>\n<p>\u7531\u4e2d\u6587\u7ffb\u8bd1\u800c\u6765\u7684\u82f1\u6587\u901a\u5e38\u4e0d\u533a\u5206\u5927\u5c0f\u5199\uff0c\u4f46\u5728\u6807\u9898\u4e2d\uff0c\u90e8\u5206\u5355\u8bcd\u9700\u8981\u9996\u5b57\u6bcd\u5927\u5199\u3002\u4f8b\u5982\uff0c\u201chelp and feedback\u201d\u4e2d\uff0c\u201chelp\u201d\u548c\u201cfeedback\u201d\u7684\u9996\u5b57\u6bcd\u5e94\u5927\u5199\u3002<\/p>\n<p>\u4f20\u7edf\u7684 text-transform: capitalize \u65e0\u6cd5\u6ee1\u8db3\u9700\u6c42\uff0c\u56e0\u4e3a\u5b83\u4f1a\u5c06\u6240\u6709\u5355\u8bcd\u7684\u9996\u5b57\u6bcd\u5927\u5199\uff0c\u5305\u62ec\u8fde\u8bcd\u201cand\u201d\u3002<\/p>\n<p>\u4ee5\u4e0b javascript \u51fd\u6570\u53ef\u4ee5\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>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u4e2a\u51fd\u6570\u5c06\u5b57\u7b26\u4e32\u5206\u5272\u6210\u5355\u8bcd\uff0c\u5e76\u904d\u5386\u6bcf\u4e2a\u5355\u8bcd\u3002\u5982\u679c\u5355\u8bcd\u662f\u5f00\u5934\u5355\u8bcd\u6216\u4e0d\u5728\u9884\u5b9a\u7684\u6392\u9664\u5c0f\u5199\u5355\u8bcd\u5217\u8868\u4e2d\uff0c\u5219\u5c06\u5176\u9996\u5b57\u6bcd\u5927\u5199\u3002<\/p>\n<p>\u4f7f\u7528\u8bf4\u660e\uff1a<\/p>\n<pre>const input = \"help and feedback\";\nconst output = capitalizeFirstLetter(input);\nconsole.log(output); \/\/ \"Help and Feedback\"<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5b9e\u73b0\u82f1\u6587\u6807\u9898\u4e2d\u90e8\u5206\u5355\u8bcd\u9996\u5b57\u6bcd\u5927\u5199\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6807\u9898\u5355\u8bcd\u9996\u5b57\u6bcd\u5927\u5199\u5b9e\u73b0 \u7531\u4e2d\u6587\u7ffb\u8bd1\u800c\u6765\u7684\u82f1\u6587\u901a\u5e38\u4e0d\u533a\u5206\u5927\u5c0f\u5199\uff0c\u4f46\u5728\u6807\u9898\u4e2d\uff0c\u90e8\u5206\u5355\u8bcd\u9700\u8981\u9996\u5b57\u6bcd\u5927\u5199\u3002\u4f8b\u5982\uff0c\u201chelp and feedback\u201d\u4e2d\uff0c\u201chelp\u201d\u548c\u201cfeedback\u201d\u7684\u9996\u5b57\u6bcd\u5e94\u5927\u5199\u3002 \u4f20\u7edf\u7684 text-transform: capitalize \u65e0\u6cd5\u6ee1\u8db3\u9700\u6c42\uff0c\u56e0\u4e3a\u5b83\u4f1a\u5c06\u6240\u6709\u5355\u8bcd\u7684\u9996\u5b57\u6bcd\u5927\u5199\uff0c\u5305\u62ec\u8fde\u8bcd\u201cand\u201d\u3002 \u4ee5\u4e0b javascript \u51fd\u6570\u53ef\u4ee5\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;); } \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u4e2a\u51fd\u6570\u5c06\u5b57\u7b26\u4e32\u5206\u5272\u6210\u5355\u8bcd\uff0c\u5e76\u904d\u5386\u6bcf\u4e2a\u5355\u8bcd\u3002\u5982\u679c\u5355\u8bcd\u662f\u5f00\u5934\u5355\u8bcd\u6216\u4e0d\u5728\u9884\u5b9a\u7684\u6392\u9664\u5c0f\u5199\u5355\u8bcd\u5217\u8868\u4e2d\uff0c\u5219\u5c06\u5176\u9996\u5b57\u6bcd\u5927\u5199\u3002 \u4f7f\u7528\u8bf4\u660e\uff1a const input = [&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-1694","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/1694","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=1694"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/1694\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=1694"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=1694"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=1694"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}