{"id":35269,"date":"2024-11-26T12:21:11","date_gmt":"2024-11-26T04:21:11","guid":{"rendered":"https:\/\/fwq.ai\/blog\/35269\/"},"modified":"2024-11-26T12:21:11","modified_gmt":"2024-11-26T04:21:11","slug":"java%e6%80%8e%e4%b9%88%e5%b0%86%e5%ad%97%e7%ac%a6%e4%b8%b2%e5%8f%98%e6%88%90%e6%95%b0%e7%bb%84","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/35269\/","title":{"rendered":"java\u600e\u4e48\u5c06\u5b57\u7b26\u4e32\u53d8\u6210\u6570\u7ec4"},"content":{"rendered":"<blockquote><p>\n  \u53ef\u4ee5\u4f7f\u7528 string.tochararray() \u65b9\u6cd5\u5c06 java \u4e2d\u7684\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u5b57\u7b26\u6570\u7ec4\u3002\u8be5\u65b9\u6cd5\u8fd4\u56de\u4e00\u4e2a\u5305\u542b\u6bcf\u4e2a\u5b57\u7b26 unicode \u4ee3\u7801\u7684\u5b57\u7b26\u6570\u7ec4\uff0c\u4e0d\u4fee\u6539\u539f\u59cb\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff0c\u5c06 &#8220;hello&#8221; \u8f6c\u6362\u4e3a\u5b57\u7b26\u6570\u7ec4\u4f1a\u5f97\u5230 [h, e, l, l, o]\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202411\/03\/2024110323002778949.jpg\" class=\"aligncenter\" title=\"java\u600e\u4e48\u5c06\u5b57\u7b26\u4e32\u53d8\u6210\u6570\u7ec4\u63d2\u56fe\" alt=\"java\u600e\u4e48\u5c06\u5b57\u7b26\u4e32\u53d8\u6210\u6570\u7ec4\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5c06 Java \u4e2d\u7684\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u6570\u7ec4<\/strong><\/p>\n<p><strong>\u76f4\u63a5\u56de\u7b54\uff1a<\/strong><br \/>\u53ef\u4ee5\u4f7f\u7528 String.toCharArray() \u65b9\u6cd5\u5c06 Java \u4e2d\u7684\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u5b57\u7b26\u6570\u7ec4\u3002<\/p>\n<p><strong>\u8be6\u7ec6\u89e3\u91ca\uff1a<\/strong><\/p>\n<p>String.toCharArray() \u65b9\u6cd5\u8fd4\u56de\u4e00\u4e2a\u5b57\u7b26\u6570\u7ec4\uff0c\u5176\u4e2d\u5305\u542b\u5b57\u7b26\u4e32\u4e2d\u6bcf\u4e2a\u5b57\u7b26\u7684 Unicode \u5b57\u7b26\u4ee3\u7801\u3002\u8be5\u65b9\u6cd5\u4e0d\u4fee\u6539\u539f\u59cb\u5b57\u7b26\u4e32\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p><strong>\u8bed\u6cd5\uff1a<\/strong><\/p>\n<pre>char[] charArray = string.toCharArray();<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre>String myString = \"Hello\";\nchar[] myCharArray = myString.toCharArray();\nSystem.out.println(myCharArray); \/\/ \u8f93\u51fa\uff1a[H, e, l, l, o]<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6ce8\u610f\uff1a<\/strong><\/p>\n<ul>\n<li>\u8fd9\u5c06\u521b\u5efa\u4e00\u4e2a\u5305\u542b Unicode \u5b57\u7b26\u4ee3\u7801\u7684\u5b57\u7b26\u6570\u7ec4\u3002\u8981\u83b7\u5f97\u5b57\u7b26\u4e32\u7684\u5404\u4e2a\u5b57\u7b26\uff0c\u53ef\u4ee5\u4f7f\u7528 Character.toString(char) \u65b9\u6cd5\u5c06\u5b57\u7b26\u4ee3\u7801\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\u3002<\/li>\n<li>\u5982\u679c\u5b57\u7b26\u4e32\u5305\u542b Unicode \u8865\u5145\u5b57\u7b26\uff0c\u8be5\u65b9\u6cd5\u4f1a\u5c06\u5b83\u4eec\u8f6c\u6362\u4e3a\u4e00\u5bf9\u4ee3\u7406\u5b57\u7b26\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662fjava\u600e\u4e48\u5c06\u5b57\u7b26\u4e32\u53d8\u6210\u6570\u7ec4\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>\u53ef\u4ee5\u4f7f\u7528 string.tochararray() \u65b9\u6cd5\u5c06 java \u4e2d\u7684\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u5b57\u7b26\u6570\u7ec4\u3002\u8be5\u65b9\u6cd5\u8fd4\u56de\u4e00\u4e2a\u5305\u542b\u6bcf\u4e2a\u5b57\u7b26 unicode \u4ee3\u7801\u7684\u5b57\u7b26\u6570\u7ec4\uff0c\u4e0d\u4fee\u6539\u539f\u59cb\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff0c\u5c06 &#8220;hello&#8221; \u8f6c\u6362\u4e3a\u5b57\u7b26\u6570\u7ec4\u4f1a\u5f97\u5230 [h, e, l, l, o]\u3002 \u5982\u4f55\u5c06 Java \u4e2d\u7684\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u6570\u7ec4 \u76f4\u63a5\u56de\u7b54\uff1a\u53ef\u4ee5\u4f7f\u7528 String.toCharArray() \u65b9\u6cd5\u5c06 Java \u4e2d\u7684\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u5b57\u7b26\u6570\u7ec4\u3002 \u8be6\u7ec6\u89e3\u91ca\uff1a String.toCharArray() \u65b9\u6cd5\u8fd4\u56de\u4e00\u4e2a\u5b57\u7b26\u6570\u7ec4\uff0c\u5176\u4e2d\u5305\u542b\u5b57\u7b26\u4e32\u4e2d\u6bcf\u4e2a\u5b57\u7b26\u7684 Unicode \u5b57\u7b26\u4ee3\u7801\u3002\u8be5\u65b9\u6cd5\u4e0d\u4fee\u6539\u539f\u59cb\u5b57\u7b26\u4e32\u3002 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u8bed\u6cd5\uff1a char[] charArray = string.toCharArray(); \u767b\u5f55\u540e\u590d\u5236 \u793a\u4f8b\uff1a String myString = &#8220;Hello&#8221;; char[] myCharArray = myString.toCharArray(); System.out.println(myCharArray); \/\/ \u8f93\u51fa\uff1a[H, e, l, l, o] \u767b\u5f55\u540e\u590d\u5236 \u6ce8\u610f\uff1a \u8fd9\u5c06\u521b\u5efa\u4e00\u4e2a\u5305\u542b Unicode \u5b57\u7b26\u4ee3\u7801\u7684\u5b57\u7b26\u6570\u7ec4\u3002\u8981\u83b7\u5f97\u5b57\u7b26\u4e32\u7684\u5404\u4e2a\u5b57\u7b26\uff0c\u53ef\u4ee5\u4f7f\u7528 [&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-35269","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/35269","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=35269"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/35269\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=35269"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=35269"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=35269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}