Java tutorial
//package com.java2s; //License from project: Apache License public class Main { public static boolean isEmptyStrict(String str) { if (isEmpty(str)) { return true; } for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (c != ' ' && c != '\t' && c != '\r' && c != '\n') { return false; } } return true; } public static boolean isEmpty(String str) { return str == null || str.trim().length() == 0 || str.trim().equalsIgnoreCase("null"); } }