lang3 library StringUtils class isBlank method

Full path of StringUtils class:

import org.apache.commons.lang3.StringUtils;

isBlank

isBlank is used to determine whether the string is blank. Returns true if the string is null, an empty string (""), or is made up of blank characters, otherwise false. What are white space characters? java.lang.Character class isWhitespace static method determines that the character that is true is a blank character.

isAnyBlank determines whether at least one string is blank

println(StringUtils.isAnyBlank(null));// Special attention shall be paid to false, which is not in line with the expectationprintln(StringUtils.isAnyBlank(null,null));// trueprintln(StringUtils.isAnyBlank("",null));// trueprintln(StringUtils.isAnyBlank("","\n"));// trueprintln(StringUtils.isAnyBlank(newString[]{"","\n"}));// trueprintln(StringUtils.isAnyBlank("abc"));// falseprintln(StringUtils.isAnyBlank("abc",""));// trueprintln(StringUtils.isAnyBlank("abc","","xy"));// true

isNoneBlank determines whether multiple strings are blank

println(StringUtils.isNoneBlank(null));// Pay special attention to "true -" this does not meet the expectationprintln(StringUtils.isNoneBlank(null,null));// falseprintln(StringUtils.isNoneBlank("",null));// falseprintln(StringUtils.isNoneBlank("","\n"));// falseprintln(StringUtils.isNoneBlank(newString[]{"","\n"}));// falseprintln(StringUtils.isNoneBlank("abc"));// trueprintln(StringUtils.isNoneBlank("abc",""));// falseprintln(StringUtils.isNoneBlank("abc","xy"));// true

lang3 library StringUtils class trim, strip method

Full path of StringUtils class:

import org.apache.commons.lang3.StringUtils;

The trim method is similar to the strip method in that it removes white space from both sides of the string.

The definition of empty white character in strip method is: the character judged as true by isWhitespace static method of java.lang.Character class is blank character. The definition of empty white character in trim method is: control character whose ascii code is less than or equal to 32.