{"id":5412,"date":"2023-01-05T12:37:33","date_gmt":"2023-01-05T04:37:33","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=5412"},"modified":"2023-01-05T12:37:33","modified_gmt":"2023-01-05T04:37:33","slug":"1-%e4%ba%86%e8%a7%a3typescript%e5%ad%97%e4%b8%b2%e6%b1%82%e5%80%bc%e5%87%bd%e6%95%b8isconventioncase%e7%9a%84%e5%8a%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/typescript\/1-%e4%ba%86%e8%a7%a3typescript%e5%ad%97%e4%b8%b2%e6%b1%82%e5%80%bc%e5%87%bd%e6%95%b8isconventioncase%e7%9a%84%e5%8a%9f%e8%83%bd\/","title":{"rendered":"1.\u4e86\u89e3TypeScript\u5b57\u4e32\u6c42\u503c\u51fd\u6578isConventionCase\u7684\u529f\u80fd"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"TypeScript, isConventionCase\"><\/p>\n<h1>\u4f7f\u7528 TypeScript \u5b57\u4e32\u7684\u6c42\u662f\u5426\u70ba\u7d04\u5b9a\u5b57\u7b26\u4e32(isConventionCase)<\/h1>\n<p>TypeScript \u662f\u4e00\u7a2e\u5f37\u578b\u5225\u7684 JavaScript \u8a9e\u8a00\uff0c\u5b83\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u64b0\u5beb\u7a0b\u5f0f\u78bc\uff0c\u4e26\u4e14\u66f4\u5bb9\u6613\u5730\u6aa2\u67e5\u7a0b\u5f0f\u78bc\u7684\u6b63\u78ba\u6027\u3002TypeScript \u63d0\u4f9b\u4e86\u4e00\u500b\u53eb\u505a isConventionCase \u7684\u51fd\u5f0f\uff0c\u53ef\u4ee5\u7528\u4f86\u6aa2\u67e5\u5b57\u4e32\u662f\u5426\u7b26\u5408\u7d04\u5b9a\u7684\u683c\u5f0f\u3002<\/p>\n<p>isConventionCase \u51fd\u5f0f\u63a5\u53d7\u4e00\u500b\u5b57\u4e32\u53c3\u6578\uff0c\u4e26\u4e14\u8fd4\u56de\u4e00\u500b\u5e03\u6797\u503c\uff0c\u8868\u793a\u8a72\u5b57\u4e32\u662f\u5426\u7b26\u5408\u7d04\u5b9a\u7684\u683c\u5f0f\u3002\u7d04\u5b9a\u7684\u683c\u5f0f\u662f\u6307\u5b57\u4e32\u4e2d\u7684\u6bcf\u500b\u55ae\u8a5e\u90fd\u662f\u4ee5\u5927\u5beb\u5b57\u6bcd\u958b\u982d\uff0c\u5176\u9918\u5b57\u6bcd\u90fd\u662f\u5c0f\u5beb\u5b57\u6bcd\uff0c\u4f8b\u5982\uff1aMyNameIsJohn\u3002<\/p>\n<p>\u4e0b\u9762\u662f\u4e00\u500b\u4f7f\u7528 isConventionCase \u51fd\u5f0f\u7684\u7bc4\u4f8b\uff1a<\/p>\n<pre class=\"brush: typescript\">\nlet str = \"MyNameIsJohn\";\nlet isConventionCase = isConventionCase(str);\n\nif (isConventionCase) {\n    console.log(\"The string is in convention case.\");\n} else {\n    console.log(\"The string is not in convention case.\");\n}\n<\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u7bc4\u4f8b\u4e2d\uff0c\u6211\u5011\u5b9a\u7fa9\u4e86\u4e00\u500b\u5b57\u4e32 str\uff0c\u4e26\u4e14\u4f7f\u7528 isConventionCase \u51fd\u5f0f\u6aa2\u67e5\u8a72\u5b57\u4e32\u662f\u5426\u7b26\u5408\u7d04\u5b9a\u7684\u683c\u5f0f\u3002\u5982\u679c\u7b26\u5408\uff0c\u5247\u6703\u5728\u63a7\u5236\u53f0\u8f38\u51fa &#8220;The string is in convention case.&#8221;\uff0c\u53cd\u4e4b\u5247\u6703\u8f38\u51fa &#8220;The string is not in convention case.&#8221;\u3002<\/p>\n<p>isConventionCase \u51fd\u5f0f\u53ef\u4ee5\u7528\u4f86\u6aa2\u67e5\u5b57\u4e32\u662f\u5426\u7b26\u5408\u7d04\u5b9a\u7684\u683c\u5f0f\uff0c\u9019\u6a23\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u6aa2\u67e5\u7a0b\u5f0f\u78bc\u7684\u6b63\u78ba\u6027\uff0c\u4e26\u4e14\u66f4\u5bb9\u6613\u5730\u64b0\u5beb\u7a0b\u5f0f\u78bc\u3002<\/p>\n<p><!--more--><\/p>\n<h2>\u7e3d\u7d50<\/h2>\n<p>TypeScript \u63d0\u4f9b\u4e86\u4e00\u500b\u53eb\u505a isConventionCase \u7684\u51fd\u5f0f\uff0c\u53ef\u4ee5\u7528\u4f86\u6aa2\u67e5\u5b57\u4e32\u662f\u5426\u7b26\u5408\u7d04\u5b9a\u7684\u683c\u5f0f\u3002isConventionCase \u51fd\u5f0f\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u5730\u6aa2\u67e5\u7a0b\u5f0f\u78bc\u7684\u6b63\u78ba\u6027\uff0c\u4e26\u4e14\u66f4\u5bb9\u6613\u5730\u64b0\u5beb\u7a0b\u5f0f\u78bc\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>2.\u4e86\u89e3\u5982\u4f55\u4f7f\u7528TypeScript\u4e2d\u7684isConventionCase\u51fd\u6578\u4f86\u6aa2\u67e5\u5b57\u4e32\u662f\u5426\u7b26\u5408\u7d04\u5b9a\u5b57\u7b26\u4e32\u898f\u5247\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528\u5b83\u4f86\u63d0\u9ad8\u7a0b\u5f0f\u78bc\u7684\u53ef\u8b80\u6027<\/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-5412","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-1pi","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5412","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=5412"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5412\/revisions"}],"predecessor-version":[{"id":5413,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5412\/revisions\/5413"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=5412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=5412"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=5412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}