Skip to content

Instantly share code, notes, and snippets.

@mourawaldson
Created April 28, 2012 21:34
Show Gist options
  • Save mourawaldson/2522201 to your computer and use it in GitHub Desktop.
Save mourawaldson/2522201 to your computer and use it in GitHub Desktop.
Check if is null or empty
/**
* Verifica se a String passada por parâmetro é nula ou vazia.
*
* @param str
* String
* @return boolean true se a String for "null" ou vazia; false caso exista
* conteúdo.
*/
public static boolean isNullOrEmpty(String str) {
return ((str == null || str.isEmpty()) || str.trim().length() == 0) ? true
: false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment