{"id":2452,"date":"2018-01-30T14:39:46","date_gmt":"2018-01-30T06:39:46","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=2452"},"modified":"2018-01-30T14:39:46","modified_gmt":"2018-01-30T06:39:46","slug":"stringutils-isblank%e7%9a%84%e7%94%a8%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=2452","title":{"rendered":"StringUtils.isBlank()\u7684\u7528\u6cd5"},"content":{"rendered":"<p>\n\t\u8fd9\u662f\u4e00\u7bc7\u521d\u7ea7\u6559\u7a0b\uff0c\u4e3b\u8981\u662f\u9488\u5bf9\u521a\u53c2\u4e0e\u5de5\u4f5c\u7684\u5458\u5de5\u7684\u4e00\u4e2a\u57f9\u8bad\u3002\u8fd9\u4e9b\u65b0\u4eba\u5bf9StringUtils.isBlank\u7684\u7528\u6cd5\u4e0d\u662f\u5f88\u4e86\u89e3\uff0c\u4e3a\u4ec0\u4e48\u7528\uff1f\u4ec0\u4e48\u60c5\u51b5\u4e0b\u7528\uff1f\u548cStringUtils.isEmpty\u7684\u533a\u522b\u7b49\uff0c\u672c\u6587\u5c06\u8be6\u7ec6\u7684\u4e3a\u4f60\u89e3\u7b54\u3002\n<\/p>\n<p>\n\tStringUtils.isBlank()\u662f Spring \u6216 Apache \u7b49\u5de5\u5177\u7c7b\u4e2d\u7684\u65b9\u6cd5\uff0c\u7528\u6765\u5224\u65ad\u5b57\u7b26\u4e32\u662f\u5426\u4e3a\u7a7a\u6216\u957f\u5ea6\u4e3a0\u6216\u7531\u7a7a\u767d\u7b26(whitespace)\u6784\u6210\u3002\n<\/p>\n<p>\n\t\u5b83\u7684\u7528\u6cd5\u5982\u4e0b\uff1a\n<\/p>\n<pre class=\"brush:java;\">\r\nStringUtils.isBlank(null) = true\r\nStringUtils.isBlank(&quot;&quot;) = true\r\nStringUtils.isBlank(&quot; &quot;) = true\r\nStringUtils.isBlank(&quot;        &quot;) = true\r\nStringUtils.isBlank(&quot;\\t \\n \\f \\r&quot;) = true\/\/\u5bf9\u4e8e\u5236\u8868\u7b26\u3001\u6362\u884c\u7b26\u3001\u6362\u9875\u7b26\u548c\u56de\u8f66\u7b26 \r\nStringUtils.isBlank()   \/\/\u5747\u8bc6\u4e3a\u7a7a\u767d\u7b26 \r\nStringUtils.isBlank(&quot;\\b&quot;) = false\/\/&quot;\\b&quot;\u4e3a\u5355\u8bcd\u8fb9\u754c\u7b26 \r\nStringUtils.isBlank(&quot;bob&quot;) = false\r\nStringUtils.isBlank(&quot; bob &quot;) = false<\/pre>\n<p>\n\t\u4e0e\u4e4b\u76f8\u53cd\u7684\u65b9\u6cd5\u662f isNotBlank\u3002\u5224\u65ad\u5b57\u7b26\u4e32\u662f\u5426\u4e0d\u4e3a\u7a7a\u4e14\u957f\u5ea6\u4e0d\u4e3a0\u4e14\u4e0d\u7531\u7a7a\u767d\u7b26(whitespace) \u6784\u6210\uff0c\u7b49\u4e8e !isBlank(String str)\u3002\n<\/p>\n<p>\n\t\u4e0eStringUtils.isBlank\u5bb9\u6613\u4ea7\u751f\u6df7\u6dc6\u7684\u662fStringUtils.isEmpty\u3002\u5b83\u4eec\u53ea\u6709\u4e00\u5c0f\u70b9\u533a\u522b\u3002\n<\/p>\n<p>\n\tisEmpty(String str) \u5e38\u7528\u6765\u5224\u65ad\u5b57\u7b26\u4e32\u662f\u5426\u4e3a\u7a7a\uff0c\u4e3a\u7a7a\u7684\u6807\u51c6\u662f str==null \u6216 str.length()==0\u3002\n<\/p>\n<p>\n\tStringUtils.isEmpty\u7684\u7528\u6cd5\u5982\u4e0b\uff1a\n<\/p>\n<pre class=\"brush:java;\">\r\nStringUtils.isEmpty(null) = true\r\nStringUtils.isEmpty(&quot;&quot;) = true\r\nStringUtils.isEmpty(&quot; &quot;) = false \/\/\u6ce8\u610f\u5728 StringUtils \u4e2d\u7a7a\u683c\u4f5c\u975e\u7a7a\u5904\u7406 \r\nStringUtils.isEmpty(&quot;   &quot;) = false\r\nStringUtils.isEmpty(&quot;bob&quot;) = false\r\nStringUtils.isEmpty(&quot; bob &quot;) = false<\/pre>\n<p>\n\t\u867d\u7136\u8fd9\u4e9b\u90fd\u662f\u57fa\u7840\u77e5\u8bc6\uff0c\u4f46\u662f\u5343\u4e07\u522b\u5c0f\u77a7\u5b83\u4eec\u3002\u6210\u5927\u4e8b\u8005\uff0c\u5fc5\u5148\u4ece\u5c0f\u4e8b\u505a\u8d77\uff0c\u4ece\u70b9\u6ef4\u79ef\u7d2f\u3002<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=2452\">StringUtils.isBlank()\u7684\u7528\u6cd5<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u662f\u4e00\u7bc7\u521d\u7ea7\u6559\u7a0b\uff0c\u4e3b\u8981\u662f\u9488\u5bf9\u521a\u53c2\u4e0e\u5de5\u4f5c\u7684\u5458\u5de5\u7684\u4e00\u4e2a\u57f9\u8bad\u3002\u8fd9\u4e9b\u65b0\u4eba\u5bf9StringUtils.isBlank\u7684\u7528\u6cd5 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[69,551,99],"class_list":["post-2452","post","type-post","status-publish","format-standard","hentry","category-java","tag-java","tag-spring","tag-struts2"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2452","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2452"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2452\/revisions"}],"predecessor-version":[{"id":2453,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2452\/revisions\/2453"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2452"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2452"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2452"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}