{"id":5328,"date":"2023-01-05T12:27:39","date_gmt":"2023-01-05T04:27:39","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=5328"},"modified":"2023-01-05T12:27:39","modified_gmt":"2023-01-05T04:27:39","slug":"%e4%ba%86%e8%a7%a3typescript%e4%b8%ad%e5%ad%97%e4%b8%b2%e6%b1%82%e5%80%bc%e5%87%bd%e6%95%b8iscapitalcase%e7%9a%84%e5%8a%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/typescript\/%e4%ba%86%e8%a7%a3typescript%e4%b8%ad%e5%ad%97%e4%b8%b2%e6%b1%82%e5%80%bc%e5%87%bd%e6%95%b8iscapitalcase%e7%9a%84%e5%8a%9f%e8%83%bd\/","title":{"rendered":"\u4e86\u89e3TypeScript\u4e2d\u5b57\u4e32\u6c42\u503c\u51fd\u6578isCapitalCase\u7684\u529f\u80fd"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"TypeScript, \u5b57\u4e32, \u6c42\u662f\u5426\u70ba\u9996\u5b57\u6bcd\u5927\u5beb\u5b57\u7b26\u4e32, isCapitalCase\"><\/p>\n<h1>TypeScript \u5b57\u4e32\u7684\u6c42\u662f\u5426\u70ba\u9996\u5b57\u6bcd\u5927\u5beb\u5b57\u7b26\u4e32(isCapitalCase)<\/h1>\n<p>TypeScript \u662f\u4e00\u7a2e JavaScript \u7684\u8d85\u96c6\uff0c\u5b83\u63d0\u4f9b\u4e86\u5f37\u5927\u7684\u985e\u578b\u6aa2\u67e5\u529f\u80fd\uff0c\u53ef\u4ee5\u5e6b\u52a9\u958b\u767c\u8005\u66f4\u597d\u5730\u7ba1\u7406\u7a0b\u5f0f\u78bc\uff0c\u4e26\u6e1b\u5c11\u7a0b\u5f0f\u78bc\u51fa\u932f\u7684\u6a5f\u6703\u3002\u5728 TypeScript \u4e2d\uff0c\u958b\u767c\u8005\u53ef\u4ee5\u4f7f\u7528 isCapitalCase() \u51fd\u5f0f\u4f86\u6aa2\u67e5\u5b57\u4e32\u662f\u5426\u70ba\u9996\u5b57\u6bcd\u5927\u5beb\u5b57\u7b26\u4e32\u3002<\/p>\n<h2>isCapitalCase() \u51fd\u5f0f\u7684\u4f7f\u7528\u65b9\u6cd5<\/h2>\n<p>isCapitalCase() \u51fd\u5f0f\u53ef\u4ee5\u7528\u4f86\u6aa2\u67e5\u5b57\u4e32\u662f\u5426\u70ba\u9996\u5b57\u6bcd\u5927\u5beb\u5b57\u7b26\u4e32\uff0c\u5b83\u6703\u56de\u50b3\u4e00\u500b\u5e03\u6797\u503c\uff0c\u5982\u679c\u5b57\u4e32\u7684\u9996\u5b57\u6bcd\u662f\u5927\u5beb\uff0c\u5247\u56de\u50b3 true\uff0c\u53cd\u4e4b\u5247\u56de\u50b3 false\u3002<\/p>\n<pre class=\"brush: typescript\">\nfunction isCapitalCase(str: string): boolean {\n  return str.charAt(0) === str.charAt(0).toUpperCase();\n}\n<\/pre>\n<p>\u4ee5\u4e0b\u662f isCapitalCase() \u51fd\u5f0f\u7684\u4f7f\u7528\u7bc4\u4f8b\uff1a<\/p>\n<pre class=\"brush: typescript\">\nlet str1 = 'Hello World';\nlet str2 = 'hello world';\n\nconsole.log(isCapitalCase(str1)); \/\/ true\nconsole.log(isCapitalCase(str2)); \/\/ false\n<\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u7bc4\u4f8b\u4e2d\uff0c\u6211\u5011\u5c07 str1 \u8a2d\u5b9a\u70ba &#8216;Hello World&#8217;\uff0cstr2 \u8a2d\u5b9a\u70ba &#8216;hello world&#8217;\uff0c\u7136\u5f8c\u4f7f\u7528 isCapitalCase() \u51fd\u5f0f\u6aa2\u67e5\u5169\u500b\u5b57\u4e32\u662f\u5426\u70ba\u9996\u5b57\u6bcd\u5927\u5beb\u5b57\u7b26\u4e32\uff0c\u7d50\u679c str1 \u70ba true\uff0cstr2 \u70ba false\uff0c\u8868\u793a str1 \u7684\u9996\u5b57\u6bcd\u662f\u5927\u5beb\uff0c\u800c str2 \u7684\u9996\u5b57\u6bcd\u662f\u5c0f\u5beb\u3002<\/p>\n<h2>\u7e3d\u7d50<\/h2>\n<p>isCapitalCase() \u51fd\u5f0f\u53ef\u4ee5\u7528\u4f86\u6aa2\u67e5\u5b57\u4e32\u662f\u5426\u70ba\u9996\u5b57\u6bcd\u5927\u5beb\u5b57\u7b26\u4e32\uff0c\u5b83\u6703\u56de\u50b3\u4e00\u500b\u5e03\u6797\u503c\uff0c\u5982\u679c\u5b57\u4e32\u7684\u9996\u5b57\u6bcd\u662f\u5927\u5beb\uff0c\u5247\u56de\u50b3 true\uff0c\u53cd\u4e4b\u5247\u56de\u50b3 false\u3002\u4f7f\u7528 isCapitalCase() \u51fd\u5f0f\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u6aa2\u67e5\u5b57\u4e32\u662f\u5426\u70ba\u9996\u5b57\u6bcd\u5927\u5beb\u5b57\u7b26\u4e32\uff0c\u4ee5\u63d0\u9ad8\u7a0b\u5f0f\u78bc\u7684\u54c1\u8cea\u3002<\/p>\n<p><!--more--><\/p>\n<h2>\u66f4\u591a TypeScript \u76f8\u95dc\u6587\u7ae0<\/h2>\n<ul>\n<li><a href=\"https:\/\/example.com\/typescript-intro\" target=\"_blank\" rel=\"noopener\">TypeScript \u5165\u9580\u6559\u5b78<\/a><\/li>\n<li><a href=\"https:\/\/example.com\/typescript-data-types\" target=\"_blank\" rel=\"noopener\">TypeScript \u8cc7\u6599\u578b\u614b\u4ecb\u7d39<\/a><\/li>\n<li><a href=\"https:\/\/example.com\/typescript-functions\" target=\"_blank\" rel=\"noopener\">TypeScript \u51fd\u5f0f\u4ecb\u7d39<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3TypeScript\u4e2d\u7684\u5b57\u4e32\u6c42\u503c\u51fd\u6578isCapitalCase\uff0c\u5b83\u53ef\u4ee5\u6aa2\u67e5\u5b57\u4e32\u662f\u5426\u70ba\u9996\u5b57\u6bcd\u5927\u5beb\uff0c\u4e26\u63d0\u4f9b\u7c21\u55ae\u7684\u65b9\u6cd5\u4f86\u6aa2\u67e5\u5b57\u4e32\u7684\u683c\u5f0f\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[187],"tags":[186],"class_list":["post-5328","post","type-post","status-publish","format-standard","hentry","category-typescript","tag-typescript"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/pcFK27-1nW","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5328","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/comments?post=5328"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5328\/revisions"}],"predecessor-version":[{"id":5329,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5328\/revisions\/5329"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=5328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=5328"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=5328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}