[Base] Java Java check the string is empty, null way

In this article, we will introduce some method of checking the empty string in Java (empty or empty string). Some of our primary method of language as well as several libraries are available.

      Reference article: Address

  to sum up:

       Several of the above method to check whether the string is empty. Usually you want to check whether the string is blank, which means that it contains a space character.

     The most convenient way is to use the Apache Commons Lang, it provides helper classes such as StringUtils.isBlank like. If you want to stick with plain Java, we can trim isEmpty native string length or in combination. For Bean Validation, you can use regular expressions.

 

      

Guess you like

Origin www.cnblogs.com/2019wxw/p/12088754.html