isblank vs isempty code example
Example 1: isblank vs isempty
StringUtils.isEmpty(null) = true
StringUtils.isEmpty("") = true
StringUtils.isEmpty(" ") = false
StringUtils.isEmpty("bob") = false
StringUtils.isEmpty(" bob ") = false
Example 2: isblank vs isempty
StringUtils.isBlank(null) = true
StringUtils.isBlank("") = true
StringUtils.isBlank(" ") = true
StringUtils.isBlank("bob") = false
StringUtils.isBlank(" bob ") = false
Example 3: isblank vs isempty
public class Main
{
public static void main(String[] args)
{
System.out.println( "ABC".isBlank() );
System.out.println( " ".isBlank() );
System.out.println( "ABC".isEmpty() );
System.out.println( " ".isEmpty() );
}
}