The difference between Isnotempty and Isnotblank in StringUtils (RPM)

Source: Internet
Author: User
Tags control characters

In addition to the constructor, there are more than 130 methods in StringUtils, and are static, so we can call Stringutils.xxx ()

Isnotempty the space parameter as well, Isnotblank excludes the space argument

1. public static Boolean isEmpty (String str)
The criterion for determining whether a string is empty or null is Str==null or str.length () ==0
The following is an example of whether StringUtils is empty:
Stringutils.isempty (NULL) = True
Stringutils.isempty ("") = True
Stringutils.isempty ("") = false//note in StringUtils Hollow lattice for non-empty processing
Stringutils.isempty ("") = False
Stringutils.isempty ("Bob") = False
Stringutils.isempty ("Bob") = False

2. public static Boolean isnotempty (String str)
Determines whether a string is non-null, equal to!isempty (string str)
Here's an example:
Stringutils.isnotempty (NULL) = False
Stringutils.isnotempty ("") = False
Stringutils.isnotempty ("") = True
Stringutils.isnotempty ("") = True
Stringutils.isnotempty ("Bob") = True
Stringutils.isnotempty ("Bob") = True

3. public static Boolean IsBlank (String str)
Determines whether a string is empty or has a length of 0 or is composed of a white space character (whitespace)
Here's an example:
Stringutils.isblank (NULL) = True
Stringutils.isblank ("") = True
Stringutils.isblank ("") = True
Stringutils.isblank ("") = True
Stringutils.isblank ("/t/n/f/r") = TRUE//For tab characters, newline characters, page breaks, and carriage return Stringutils.isblank () are known as whitespace characters
Stringutils.isblank ("/b") = FALSE//"/b" for word boundary character
Stringutils.isblank ("Bob") = False
Stringutils.isblank ("Bob") = False

4. public static Boolean Isnotblank (String str)
Determines whether a string is not empty and does not have a length of 0 and is not composed of a white space character (whitespace), which is equal to!isblank (string str)
Here's an example:
Stringutils.isnotblank (NULL) = False
Stringutils.isnotblank ("") = False
Stringutils.isnotblank ("") = False
Stringutils.isnotblank ("") = False
Stringutils.isnotblank ("/t/n/f/r") = False
Stringutils.isnotblank ("/b") = True
Stringutils.isnotblank ("Bob") = True
Stringutils.isnotblank ("Bob") = True Other methods introduced: 5. public static string trim (String str)
Remove the control character at both ends of the string (control characters, Char <= 32) and return NULL if the input is null
Here's an example:
Stringutils.trim (NULL) = NULL
Stringutils.trim ("") = ""
Stringutils.trim ("") = ""
Stringutils.trim ("/b/t/n/f/r") = ""
Stringutils.trim ("/n/tss/b") = "ss"
Stringutils.trim ("D d dd") = "D d DD"
Stringutils.trim ("dd") = "DD"
Stringutils.trim ("dd") = "DD"

6. public static string Trimtonull (String str)
Removes the control character at both ends of the string (control characters, Char <= 32) and returns NULL if it becomes null or ""
Here's an example:
Stringutils.trimtonull (NULL) = NULL
Stringutils.trimtonull ("") = null
Stringutils.trimtonull ("") = null
Stringutils.trimtonull ("/b/t/n/f/r") = NULL
Stringutils.trimtonull ("/n/tss/b") = "ss"
Stringutils.trimtonull ("D d dd") = "D d DD"
Stringutils.trimtonull ("dd") = "DD"
Stringutils.trimtonull ("dd") = "DD"

7. public static string Trimtoempty (String str)
Removes the control character at both ends of the string (control characters, Char <= 32), or returns "" if it becomes null or ""
Here's an example:
Stringutils.trimtoempty (NULL) = ""
Stringutils.trimtoempty ("") = ""
Stringutils.trimtoempty ("") = ""
Stringutils.trimtoempty ("/b/t/n/f/r") = ""
Stringutils.trimtoempty ("/n/tss/b") = "ss"
Stringutils.trimtoempty ("D d dd") = "D d DD"
Stringutils.trimtoempty ("dd") = "DD"
Stringutils.trimtoempty ("dd") = "DD"

8. public static string strip (String str)
Remove whitespace characters (whitespace) at both ends of the string, or null if input is NULL
The following is an example (note and trim () difference):
Stringutils.strip (NULL) = NULL
Stringutils.strip ("") = ""
Stringutils.strip ("") = ""
Stringutils.strip ("/b/t/n/f/r") = "/b"
Stringutils.strip ("/n/tss/b") = "ss/b"
Stringutils.strip ("D d dd") = "D d DD"
Stringutils.strip ("dd") = "DD"
Stringutils.strip ("dd") = "DD"

9. public static string Striptonull (String str)
Remove whitespace character (whitespace) at both ends of the string, or null if it becomes null or ""
The following is an example (note and trimtonull () the difference):
Stringutils.striptonull (NULL) = NULL
Stringutils.striptonull ("") = null
Stringutils.striptonull ("") = null
Stringutils.striptonull ("/b/t/n/f/r") = "/b"
Stringutils.striptonull ("/n/tss/b") = "ss/b"
Stringutils.striptonull ("D d dd") = "D d DD"
Stringutils.striptonull ("dd") = "DD"
Stringutils.striptonull ("dd") = "DD"

public static string Striptoempty (String str)
Removes the white space character (whitespace) at both ends of the string, or returns "" if it becomes null or ""
The following is an example (note and trimtoempty () the difference):
Stringutils.striptonull (NULL) = ""
Stringutils.striptonull ("") = ""
Stringutils.striptonull ("") = ""
Stringutils.striptonull ("/b/t/n/f/r") = "/b"
Stringutils.striptonull ("/n/tss/b") = "ss/b"
Stringutils.striptonull ("D d dd") = "D d DD"
Stringutils.striptonull ("dd") = "DD"
Stringutils.striptonull ("dd") = "DD"

The difference between Isnotempty and Isnotblank in StringUtils (RPM)

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.