{"id":40307,"date":"2025-05-28T13:43:30","date_gmt":"2025-05-28T05:43:30","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/40307.html"},"modified":"2025-05-28T13:43:30","modified_gmt":"2025-05-28T05:43:30","slug":"%e4%b8%80%e8%b5%b7%e5%ad%a6%e6%95%b0%e6%8d%ae%e7%bb%93%e6%9e%84%e5%92%8c%e7%ae%97%e6%b3%95%ef%bc%88%e4%b8%89%ef%bc%89-%e5%ad%97%e7%ac%a6%e4%b8%b2%ef%bc%88%e7%ba%bf%e6%80%a7%e7%bb%93%e6%9e%84%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/40307.html","title":{"rendered":"\u4e00\u8d77\u5b66\u6570\u636e\u7ed3\u6784\u548c\u7b97\u6cd5\uff08\u4e09\uff09| \u5b57\u7b26\u4e32\uff08\u7ebf\u6027\u7ed3\u6784\uff09"},"content":{"rendered":"<p>\u5b57\u7b26\u4e32&#xff08;String&#xff09;<\/p>\n<p>\u5b57\u7b26\u4e32\u662f\u7531\u5b57\u7b26\u7ec4\u6210\u7684\u6709\u9650\u5e8f\u5217&#xff0c;\u5728\u8ba1\u7b97\u673a\u4e2d\u901a\u5e38\u4ee5\u5b57\u7b26\u6570\u7ec4\u5f62\u5f0f\u5b58\u50a8&#xff0c;\u652f\u6301\u62fc\u63a5\u3001\u67e5\u627e\u3001\u66ff\u6362\u7b49\u64cd\u4f5c\u3002<\/p>\n<hr \/>\n<h4 id=\"IpIFU\">\u7b80\u4ecb<\/h4>\n<p>\u5b57\u7b26\u4e32\u662f\u8ba1\u7b97\u673a\u79d1\u5b66\u4e2d\u6700\u5e38\u7528\u7684\u6570\u636e\u7c7b\u578b\u4e4b\u4e00&#xff0c;\u7531\u4e00\u7cfb\u5217\u5b57\u7b26\u7ec4\u6210\u7684\u6709\u9650\u5e8f\u5217\u3002\u5728\u5927\u591a\u6570\u7f16\u7a0b\u8bed\u8a00\u4e2d&#xff0c;\u5b57\u7b26\u4e32\u88ab\u4f5c\u4e3a\u57fa\u672c\u6570\u636e\u7c7b\u578b\u6216\u8005\u5bf9\u8c61\u63d0\u4f9b&#xff0c;\u7528\u4e8e\u8868\u793a\u6587\u672c\u3002\u4ece\u672c\u8d28\u4e0a\u8bb2&#xff0c;\u5b57\u7b26\u4e32\u53ef\u4ee5\u770b\u4f5c\u662f\u4e00\u4e2a\u6570\u7ec4&#xff0c;\u4f46\u4e0e\u666e\u901a\u6570\u7ec4\u4e0d\u540c&#xff0c;\u5b57\u7b26\u4e32\u6709\u7279\u6b8a\u7684\u5c5e\u6027\u548c\u64cd\u4f5c\u65b9\u6cd5&#xff0c;\u66f4\u9002\u5408\u5904\u7406\u6587\u672c\u6570\u636e\u3002\u5728 Java \u7b49\u73b0\u4ee3\u7f16\u7a0b\u8bed\u8a00\u4e2d&#xff0c;\u5b57\u7b26\u4e32\u662f\u4e0d\u53ef\u53d8\u7684\u5bf9\u8c61&#xff0c;\u4e00\u65e6\u521b\u5efa&#xff0c;\u5176\u5185\u5bb9\u4e0d\u53ef\u88ab\u4fee\u6539\u3002<\/p>\n<h4 id=\"ZHLuj\">\u6838\u5fc3\u7279\u6027<\/h4>\n<li>\u4e0d\u53ef\u53d8\u6027&#xff1a;\u5728 Java \u4e2d&#xff0c;\u5b57\u7b26\u4e32\u4e00\u65e6\u521b\u5efa&#xff0c;\u5176\u503c\u4e0d\u53ef\u88ab\u4fee\u6539<\/li>\n<li>\u5b57\u7b26\u5e8f\u5217&#xff1a;\u7531\u591a\u4e2a\u5b57\u7b26\u6309\u987a\u5e8f\u6392\u5217\u7ec4\u6210<\/li>\n<li>\u7d22\u5f15\u8bbf\u95ee&#xff1a;\u53ef\u4ee5\u901a\u8fc7\u7d22\u5f15\u8bbf\u95ee\u5355\u4e2a\u5b57\u7b26&#xff0c;\u7d22\u5f15\u4ece0\u5f00\u59cb<\/li>\n<li>\u5b57\u7b26\u4e32\u6c60&#xff1a;Java \u4e2d\u5e38\u91cf\u5b57\u7b26\u4e32\u4f1a\u88ab\u5b58\u50a8\u5728\u5b57\u7b26\u4e32\u4e2d\u4ee5\u8282\u7701\u5185\u5b58<\/li>\n<li>Unicode\u652f\u6301&#xff1a;\u53ef\u4ee5\u5305\u542b\u4efb\u4f55 Unicode \u5b57\u7b26&#xff0c;\u652f\u6301\u591a\u8bed\u8a00\u6587\u672c<\/li>\n<h4 id=\"kH1Um\">\u57fa\u672c\u64cd\u4f5c<\/h4>\n<p><span class=\"token comment\">\/\/ \u521b\u5efa\u5b57\u7b26\u4e32<\/span><br \/>\n<span class=\"token class-name\">String<\/span> greeting <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;\u4f60\u597d&#xff0c;\u4e16\u754c&#xff01;&#034;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token class-name\">String<\/span> name <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">String<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;Java\u7f16\u7a0b&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u5b57\u7b26\u4e32\u957f\u5ea6<\/span><br \/>\n<span class=\"token keyword\">int<\/span> length <span class=\"token operator\">&#061;<\/span> greeting<span class=\"token punctuation\">.<\/span><span class=\"token function\">length<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ 6<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u8fde\u63a5\u5b57\u7b26\u4e32<\/span><br \/>\n<span class=\"token class-name\">String<\/span> message <span class=\"token operator\">&#061;<\/span> greeting <span class=\"token operator\">&#043;<\/span> <span class=\"token string\">&#034; \u6b22\u8fce\u5b66\u4e60&#034;<\/span> <span class=\"token operator\">&#043;<\/span> name<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token class-name\">String<\/span> sameMassage <span class=\"token operator\">&#061;<\/span> greeting<span class=\"token punctuation\">.<\/span><span class=\"token function\">concat<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034; \u6b22\u8fce\u5b66\u4e60&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">concat<\/span><span class=\"token punctuation\">(<\/span>name<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u8bbf\u95ee\u5b57\u7b26<\/span><br \/>\n<span class=\"token keyword\">char<\/span> firstChar <span class=\"token operator\">&#061;<\/span> greeting<span class=\"token punctuation\">.<\/span><span class=\"token function\">charAt<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ &#039;\u4f60&#039;<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u83b7\u53d6\u5b50\u5b57\u7b26\u4e32<\/span><br \/>\n<span class=\"token class-name\">String<\/span> subStr <span class=\"token operator\">&#061;<\/span> greeting<span class=\"token punctuation\">.<\/span><span class=\"token function\">substring<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ &#034;\u4f60\u597d&#034;<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u5b57\u7b26\u4e32\u6bd4\u8f83<\/span><br \/>\n<span class=\"token keyword\">boolean<\/span> isEqual <span class=\"token operator\">&#061;<\/span> greeting<span class=\"token punctuation\">.<\/span><span class=\"token function\">equals<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u4f60\u597d&#xff0c;\u4e16\u754c&#xff01;&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ true<\/span><br \/>\n<span class=\"token keyword\">boolean<\/span> ignoreCase <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;Java&#034;<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">equalsIgnoreCase<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;java&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ true<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u67e5\u627e<\/span><br \/>\n<span class=\"token keyword\">int<\/span> index <span class=\"token operator\">&#061;<\/span> message<span class=\"token punctuation\">.<\/span><span class=\"token function\">indexOf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u6b22\u8fce&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ \u8fd4\u56de&#034;\u6b22\u8fce&#034;\u5728\u5b57\u7b26\u4e32\u4e2d\u9996\u6b21\u51fa\u73b0\u7684\u7d22\u5f15<\/span><br \/>\n<span class=\"token keyword\">boolean<\/span> contains <span class=\"token operator\">&#061;<\/span> message<span class=\"token punctuation\">.<\/span><span class=\"token function\">contains<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;Java&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ true<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u66ff\u6362<\/span><br \/>\n<span class=\"token class-name\">String<\/span> newStr <span class=\"token operator\">&#061;<\/span> greeting<span class=\"token punctuation\">.<\/span><span class=\"token function\">replace<\/span><span class=\"token punctuation\">(<\/span><span class=\"token char\">&#039;\u4f60&#039;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token char\">&#039;\u6211&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ &#034;\u6211\u597d&#xff0c;\u4e16\u754c&#xff01;&#034;<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u5206\u5272<\/span><br \/>\n<span class=\"token class-name\">String<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> parts <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;\u82f9\u679c,\u9999\u8549,\u6a59\u5b50&#034;<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">split<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;,&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ [&#034;\u82f9\u679c&#034;, &#034;\u9999\u8549&#034;, &#034;\u6a59\u5b50&#034;]<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u8f6c\u6362\u5927\u5c0f\u5199&#xff08;\u4ec5\u9002\u7528\u4e8e\u62c9\u4e01\u5b57\u6bcd&#xff09;<\/span><br \/>\n<span class=\"token class-name\">String<\/span> upper <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;hello&#034;<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">toUpperCase<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ &#034;HELLO&#034;<\/span><br \/>\n<span class=\"token class-name\">String<\/span> lower <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;HELLO&#034;<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">toLowerCase<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ &#034;hello&#034;<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u53bb\u9664\u9996\u5c3e\u7a7a\u767d<\/span><br \/>\n<span class=\"token class-name\">String<\/span> trimmed <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;  hello  &#034;<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">trim<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ &#034;hello&#034;<\/span><\/p>\n<h4 id=\"AdHYC\">\u4f18\u7f3a\u70b9<\/h4>\n<h5 id=\"DDpgp\">\u4f18\u70b9<\/h5>\n<ul>\n<li>\u6613\u7528\u6027&#xff1a;\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684 API \u548c\u64cd\u4f5c\u65b9\u6cd5&#xff0c;\u5904\u7406\u6587\u672c\u66f4\u65b9\u4fbf<\/li>\n<li>\u56fd\u9645\u5316\u652f\u6301&#xff1a;\u652f\u6301 Unicode \u5b57\u7b26\u96c6&#xff0c;\u53ef\u4ee5\u5904\u7406\u5404\u79cd\u8bed\u8a00\u7684\u6587\u672c<\/li>\n<li>\u5185\u5b58\u4f18\u5316&#xff1a;\u5b57\u7b26\u4e32\u6c60\u673a\u5236\u51cf\u5c11\u5185\u5b58\u4f7f\u7528<\/li>\n<\/ul>\n<h4 id=\"ALwrj\">\u5e94\u7528\u573a\u666f<\/h4>\n<ul>\n<li>\u6587\u672c\u5904\u7406&#xff1a;\u5904\u7406\u7528\u6237\u8f93\u5165&#xff0c;\u914d\u7f6e\u6587\u4ef6\u3001\u65e5\u5fd7\u7b49<\/li>\n<li>\u6570\u636e\u89e3\u6790&#xff1a;\u89e3\u6790 JSON\u3001XML\u3001CSV\u7b49\u683c\u5f0f\u7684\u6570\u636e<\/li>\n<li>\u81ea\u7136\u8bed\u8a00\u5904\u7406&#xff1a;\u6587\u672c\u5206\u6790\u3001\u60c5\u611f\u5206\u6790\u3001\u673a\u5668\u7ffb\u8bd1\u7b49<\/li>\n<li>\u7f51\u7edc\u901a\u4fe1&#xff1a;http \u8bf7\u6c42\u53c2\u6570\u3001URL\u5904\u7406\u3001\u7f51\u7edc\u534f\u8bae\u7b49<\/li>\n<li>\u7528\u6237\u754c\u9762&#xff1a;\u6587\u672c\u663e\u793a\u3001\u591a\u8bed\u8a00\u652f\u6301\u7b49<\/li>\n<\/ul>\n<h4 id=\"MNgwr\">\u6269\u5c55<\/h4>\n<p> StringBuilder\u3001StringBuffer\u3001String <\/p>\n<ul>\n<li>String&#xff1a;\u4e0d\u53ef\u53d8&#xff0c;\u9002\u5408\u4f5c\u4e3a\u5e38\u91cf\u4f7f\u7528<\/li>\n<li>StringBuilder&#xff1a;\u53ef\u53d8&#xff0c;\u975e\u7ebf\u7a0b\u5b89\u5168&#xff0c;\u9002\u5408\u5355\u7ebf\u7a0b\u4e0b\u9891\u7e41\u4fee\u6539\u5b57\u7b26\u4e32<\/li>\n<li>StringBuffer&#xff1a;\u53ef\u53d8&#xff0c;\u7ebf\u7a0b\u5b89\u5168&#xff0c;\u9002\u5408\u5728\u591a\u7ebf\u7a0b\u73af\u5883\u4f7f\u7528&#xff0c;\u4f46\u6027\u80fd\u7565\u4f4e\u4e8e StringBuilder<\/li>\n<\/ul>\n<h4 id=\"XUObL\">\u70ed\u95e8\u9898\u76ee<\/h4>\n<ul>\n<li>14. \u6700\u957f\u516c\u5171\u524d\u7f00<\/li>\n<li>20. \u6709\u6548\u7684\u62ec\u53f7<\/li>\n<li>415. \u5b57\u7b26\u4e32\u76f8\u52a0<\/li>\n<\/ul>\n<h5 id=\"SOPfT\">20. \u6709\u6548\u7684\u62ec\u53f7<\/h5>\n<p>\u7ed9\u5b9a\u4e00\u4e2a\u53ea\u5305\u62ec \u2018(\u2019&#xff0c;\u2018)\u2019&#xff0c;\u2018{\u2019&#xff0c;\u2018}\u2019&#xff0c;\u2018[\u2019&#xff0c;\u2018]\u2019 \u7684\u5b57\u7b26\u4e32 s &#xff0c;\u5224\u65ad\u5b57\u7b26\u4e32\u662f\u5426\u6709\u6548\u3002 \u6709\u6548\u5b57\u7b26\u4e32\u9700\u6ee1\u8db3&#xff1a; \u5de6\u62ec\u53f7\u5fc5\u987b\u7528\u76f8\u540c\u7c7b\u578b\u7684\u53f3\u62ec\u53f7\u95ed\u5408\u3002 \u5de6\u62ec\u53f7\u5fc5\u987b\u4ee5\u6b63\u786e\u7684\u987a\u5e8f\u95ed\u5408\u3002 \u6bcf\u4e2a\u53f3\u62ec\u53f7\u90fd\u6709\u4e00\u4e2a\u5bf9\u5e94\u7684\u76f8\u540c\u7c7b\u578b\u7684\u5de6\u62ec\u53f7\u3002<\/p>\n<p>\u793a\u4f8b&#xff1a;<\/p>\n<p>\u8f93\u5165&#xff1a;s &#061; \u201c()\u201d<\/p>\n<p>\u8f93\u51fa&#xff1a;true<\/p>\n<p>\u9898\u89e3&#xff1a;<\/p>\n<p>\u6808&#xff0c;\u540e\u8fdb\u5148\u51fa&#xff08;LIFO&#xff09;<\/p>\n<li>\u521d\u59cb\u5316\u4e00\u4e2a\u7a7a\u6808 stack<\/li>\n<li>\u5b9a\u4e49\u4e00\u4e2a\u5b57\u5178 mapping&#xff0c;\u7528\u4e8e\u8bb0\u5f55\u53f3\u62ec\u53f7\u4e0e\u5de6\u62ec\u53f7\u7684\u5bf9\u5e94\u5173\u7cfb<\/li>\n<li>\u904d\u5386\u5b57\u7b26\u4e32\u4e2d\u7684\u6bcf\u4e00\u4e2a\u5b57\u7b26&#xff1a;\n<li>\u5982\u679c\u662f\u5de6\u62ec\u53f7&#xff0c;\u538b\u5165\u6808<\/li>\n<li>\u5982\u679c\u662f\u53f3\u62ec\u53f7&#xff1a;\n<li>\u5982\u679c\u6808\u4e3a\u7a7a&#xff0c;\u8bf4\u660e\u6ca1\u6709\u5bf9\u5e94\u7684\u5de6\u62ec\u53f7&#xff0c;\u8fd4\u56de False<\/li>\n<li>\u5426\u5219&#xff0c;\u5f39\u51fa\u6808\u9876\u5143\u7d20&#xff0c;\u6bd4\u8f83\u662f\u5426\u662f\u5bf9\u5e94\u7684\u5de6\u62ec\u53f7&#xff0c;\u4e0d\u662f\u5219\u8fd4\u56de False<\/li>\n<\/li>\n<\/li>\n<li>\u904d\u5386\u7ed3\u675f\u540e&#xff0c;\u68c0\u67e5\u6808\u662f\u5426\u4e3a\u7a7a\u3002\u5982\u679c\u6808\u4e3a\u7a7a&#xff0c;\u8bf4\u660e\u62ec\u53f7\u5b8c\u5168\u5339\u914d&#xff0c;\u8fd4\u56de True&#xff1b;\u53cd\u4e4b\u8bf4\u660e\u6709\u672a\u5339\u914d\u7684\u5de6\u62ec\u53f7&#xff0c;\u8fd4\u56de False<\/li>\n<p><span class=\"token keyword\">class<\/span> <span class=\"token class-name\">Solution<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">boolean<\/span> <span class=\"token function\">isValid<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">String<\/span> s<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u4f7f\u7528 Deque \u63a5\u53e3\u5b9e\u73b0\u6808\u7ed3\u6784&#xff0c;\u6548\u7387\u4f18\u4e8e Stack \u7c7b<\/span><br \/>\n        <span class=\"token class-name\">Deque<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token class-name\">Character<\/span><span class=\"token punctuation\">&gt;<\/span><\/span> stack <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">ArrayDeque<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token punctuation\">&gt;<\/span><\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ \u5b9a\u4e49\u4e00\u4e2a\u54c8\u5e0c\u8868&#xff0c;\u7528\u4e8e\u5b58\u50a8\u53f3\u62ec\u53f7\u5230\u5de6\u62ec\u53f7\u7684\u6620\u5c04<\/span><br \/>\n        <span class=\"token class-name\">Map<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token class-name\">Character<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">Character<\/span><span class=\"token punctuation\">&gt;<\/span><\/span> mapping <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">HashMap<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token punctuation\">&gt;<\/span><\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        mapping<span class=\"token punctuation\">.<\/span><span class=\"token function\">put<\/span><span class=\"token punctuation\">(<\/span><span class=\"token char\">&#039;)&#039;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token char\">&#039;(&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        mapping<span class=\"token punctuation\">.<\/span><span class=\"token function\">put<\/span><span class=\"token punctuation\">(<\/span><span class=\"token char\">&#039;}&#039;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token char\">&#039;{&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        mapping<span class=\"token punctuation\">.<\/span><span class=\"token function\">put<\/span><span class=\"token punctuation\">(<\/span><span class=\"token char\">&#039;]&#039;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token char\">&#039;[&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ \u904d\u5386\u5b57\u7b26\u4e32\u4e2d\u7684\u6bcf\u4e00\u4e2a\u5b57\u7b26<\/span><br \/>\n        <span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">char<\/span> c <span class=\"token operator\">:<\/span> s<span class=\"token punctuation\">.<\/span><span class=\"token function\">toCharArray<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token comment\">\/\/ \u5982\u679c\u5f53\u524d\u5b57\u7b26\u662f\u53f3\u62ec\u53f7<\/span><br \/>\n            <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>mapping<span class=\"token punctuation\">.<\/span><span class=\"token function\">containsKey<\/span><span class=\"token punctuation\">(<\/span>c<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n                <span class=\"token comment\">\/\/ \u5982\u679c\u6808\u4e3a\u7a7a&#xff0c;\u8bf4\u660e\u6ca1\u6709\u5bf9\u5e94\u7684\u5de6\u62ec\u53f7&#xff0c;\u76f4\u63a5\u8fd4\u56de false<\/span><br \/>\n                <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>stack<span class=\"token punctuation\">.<\/span><span class=\"token function\">isEmpty<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n                    <span class=\"token keyword\">return<\/span> <span class=\"token boolean\">false<\/span><span class=\"token punctuation\">;<\/span><br \/>\n                <span class=\"token punctuation\">}<\/span><br \/>\n                <span class=\"token comment\">\/\/ \u5f39\u51fa\u6808\u9876\u5143\u7d20&#xff0c;\u5e76\u4e0e\u5f53\u524d\u53f3\u62ec\u53f7\u5bf9\u5e94\u7684\u5de6\u62ec\u53f7\u6bd4\u8f83<\/span><br \/>\n                <span class=\"token keyword\">char<\/span> top <span class=\"token operator\">&#061;<\/span> stack<span class=\"token punctuation\">.<\/span><span class=\"token function\">pop<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n                <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>mapping<span class=\"token punctuation\">.<\/span><span class=\"token function\">get<\/span><span class=\"token punctuation\">(<\/span>c<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">!&#061;<\/span> top<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n                    <span class=\"token keyword\">return<\/span> <span class=\"token boolean\">false<\/span><span class=\"token punctuation\">;<\/span><br \/>\n                <span class=\"token punctuation\">}<\/span><br \/>\n            <span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">else<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n                <span class=\"token comment\">\/\/ \u5982\u679c\u662f\u5de6\u62ec\u53f7&#xff0c;\u76f4\u63a5\u538b\u5165\u6808\u4e2d<\/span><br \/>\n                stack<span class=\"token punctuation\">.<\/span><span class=\"token function\">push<\/span><span class=\"token punctuation\">(<\/span>c<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token punctuation\">}<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ \u904d\u5386\u7ed3\u675f&#xff0c;\u5982\u679c\u6808\u4e3a\u7a7a&#xff0c;\u8bf4\u660e\u6240\u6709\u62ec\u53f7\u90fd\u6b63\u786e\u5339\u914d<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> stack<span class=\"token punctuation\">.<\/span><span class=\"token function\">isEmpty<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250528054329-6836a2811e260.png\" alt=\"\" \/><\/p>\n<h4 id=\"aNFJm\">\u53c2\u8003\u8d44\u6599<\/h4>\n<p>[1] Hello \u7b97\u6cd5 [2] \u7b97\u6cd5\u5bfc\u822a<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb615\u6b21\uff0c\u70b9\u8d5e6\u6b21\uff0c\u6536\u85cf11\u6b21\u3002\u5b57\u7b26\u4e32\u662f\u7531\u5b57\u7b26\u7ec4\u6210\u7684\u6709\u9650\u5e8f\u5217\uff0c\u5728\u8ba1\u7b97\u673a\u4e2d\u901a\u5e38\u4ee5\u5b57\u7b26\u6570\u7ec4\u5f62\u5f0f\u5b58\u50a8\uff0c\u652f\u6301\u62fc\u63a5\u3001\u67e5\u627e\u3001\u66ff\u6362\u7b49\u64cd\u4f5c<\/p>\n","protected":false},"author":2,"featured_media":40306,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99,1813,3690,427],"topic":[],"class_list":["post-40307","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-java","tag-1813","tag-3690","tag-427"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4e00\u8d77\u5b66\u6570\u636e\u7ed3\u6784\u548c\u7b97\u6cd5\uff08\u4e09\uff09| \u5b57\u7b26\u4e32\uff08\u7ebf\u6027\u7ed3\u6784\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/40307.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4e00\u8d77\u5b66\u6570\u636e\u7ed3\u6784\u548c\u7b97\u6cd5\uff08\u4e09\uff09| \u5b57\u7b26\u4e32\uff08\u7ebf\u6027\u7ed3\u6784\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb615\u6b21\uff0c\u70b9\u8d5e6\u6b21\uff0c\u6536\u85cf11\u6b21\u3002\u5b57\u7b26\u4e32\u662f\u7531\u5b57\u7b26\u7ec4\u6210\u7684\u6709\u9650\u5e8f\u5217\uff0c\u5728\u8ba1\u7b97\u673a\u4e2d\u901a\u5e38\u4ee5\u5b57\u7b26\u6570\u7ec4\u5f62\u5f0f\u5b58\u50a8\uff0c\u652f\u6301\u62fc\u63a5\u3001\u67e5\u627e\u3001\u66ff\u6362\u7b49\u64cd\u4f5c\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/40307.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-28T05:43:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250528054329-6836a2811e260.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/40307.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/40307.html\",\"name\":\"\u4e00\u8d77\u5b66\u6570\u636e\u7ed3\u6784\u548c\u7b97\u6cd5\uff08\u4e09\uff09| \u5b57\u7b26\u4e32\uff08\u7ebf\u6027\u7ed3\u6784\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-05-28T05:43:30+00:00\",\"dateModified\":\"2025-05-28T05:43:30+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/40307.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/40307.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/40307.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4e00\u8d77\u5b66\u6570\u636e\u7ed3\u6784\u548c\u7b97\u6cd5\uff08\u4e09\uff09| \u5b57\u7b26\u4e32\uff08\u7ebf\u6027\u7ed3\u6784\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u4e00\u8d77\u5b66\u6570\u636e\u7ed3\u6784\u548c\u7b97\u6cd5\uff08\u4e09\uff09| \u5b57\u7b26\u4e32\uff08\u7ebf\u6027\u7ed3\u6784\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/40307.html","og_locale":"zh_CN","og_type":"article","og_title":"\u4e00\u8d77\u5b66\u6570\u636e\u7ed3\u6784\u548c\u7b97\u6cd5\uff08\u4e09\uff09| \u5b57\u7b26\u4e32\uff08\u7ebf\u6027\u7ed3\u6784\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb615\u6b21\uff0c\u70b9\u8d5e6\u6b21\uff0c\u6536\u85cf11\u6b21\u3002\u5b57\u7b26\u4e32\u662f\u7531\u5b57\u7b26\u7ec4\u6210\u7684\u6709\u9650\u5e8f\u5217\uff0c\u5728\u8ba1\u7b97\u673a\u4e2d\u901a\u5e38\u4ee5\u5b57\u7b26\u6570\u7ec4\u5f62\u5f0f\u5b58\u50a8\uff0c\u652f\u6301\u62fc\u63a5\u3001\u67e5\u627e\u3001\u66ff\u6362\u7b49\u64cd\u4f5c","og_url":"https:\/\/www.wsisp.com\/helps\/40307.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-05-28T05:43:30+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250528054329-6836a2811e260.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/40307.html","url":"https:\/\/www.wsisp.com\/helps\/40307.html","name":"\u4e00\u8d77\u5b66\u6570\u636e\u7ed3\u6784\u548c\u7b97\u6cd5\uff08\u4e09\uff09| \u5b57\u7b26\u4e32\uff08\u7ebf\u6027\u7ed3\u6784\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-05-28T05:43:30+00:00","dateModified":"2025-05-28T05:43:30+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/40307.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/40307.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/40307.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u4e00\u8d77\u5b66\u6570\u636e\u7ed3\u6784\u548c\u7b97\u6cd5\uff08\u4e09\uff09| \u5b57\u7b26\u4e32\uff08\u7ebf\u6027\u7ed3\u6784\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/40307","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=40307"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/40307\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/40306"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=40307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=40307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=40307"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=40307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}