Differences between Isblank and IsEmpty methods in the Org.apache.commons.lang3.StringUtils class

Source: Internet
Author: User

I believe many Java programmers when writing code when it is necessary to determine whether a string is empty when the StringUtils class will use the Isblank and IsEmpty methods, what is the difference between the two methods? Let's use a piece of code to illustrate the difference:

1     @Test 2      Public void Blankempty () {3         String str = ""; 4         System.out.println ("is empty" + Stringutils.isempty (str)); 5         System.out.println ("is blank?" + Stringutils.isblank (str)); 6     }

That is, the Isblank method will remove the space to determine whether STR length is 0, and the IsEmpty method will not ignore the space, directly calculate the length of STR, the length of more than 0 returns false.

Differences between Isblank and IsEmpty methods in the Org.apache.commons.lang3.StringUtils class

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.