fork download
  1. public class Main
  2. {
  3. public static boolean isEmpty(String s)
  4. {
  5. if ((s != null) && (s.trim().length() > 0))
  6. return false;
  7. else
  8. return true;
  9. }
  10.  
  11. public static boolean isBlank(String str) {
  12. int strLen;
  13. if (str == null || (strLen = str.length()) == 0) {
  14. return true;
  15. }
  16. for (int i = 0; i < strLen; i++) {
  17. if ((Character.isWhitespace(str.charAt(i)) == false)) {
  18. return false;
  19. }
  20. }
  21. return true;
  22. }
  23.  
  24. public static void main(String[] args)
  25. {
  26. for (char c = 0; c < 65535; c++)
  27. {
  28. String cs = ""+c;
  29. if (isBlank(cs) != isEmpty(cs))
  30. System.out.println("For character "+(int)c+" isBlank = "+isBlank(cs)+" and isEmpty = "+isEmpty(cs));
  31. }
  32. }
  33. }
Success #stdin #stdout 0.1s 380480KB
stdin
Standard input is empty
stdout
For character 0 isBlank = false and isEmpty = true
For character 1 isBlank = false and isEmpty = true
For character 2 isBlank = false and isEmpty = true
For character 3 isBlank = false and isEmpty = true
For character 4 isBlank = false and isEmpty = true
For character 5 isBlank = false and isEmpty = true
For character 6 isBlank = false and isEmpty = true
For character 7 isBlank = false and isEmpty = true
For character 8 isBlank = false and isEmpty = true
For character 14 isBlank = false and isEmpty = true
For character 15 isBlank = false and isEmpty = true
For character 16 isBlank = false and isEmpty = true
For character 17 isBlank = false and isEmpty = true
For character 18 isBlank = false and isEmpty = true
For character 19 isBlank = false and isEmpty = true
For character 20 isBlank = false and isEmpty = true
For character 21 isBlank = false and isEmpty = true
For character 22 isBlank = false and isEmpty = true
For character 23 isBlank = false and isEmpty = true
For character 24 isBlank = false and isEmpty = true
For character 25 isBlank = false and isEmpty = true
For character 26 isBlank = false and isEmpty = true
For character 27 isBlank = false and isEmpty = true
For character 5760 isBlank = true and isEmpty = false
For character 6158 isBlank = true and isEmpty = false
For character 8192 isBlank = true and isEmpty = false
For character 8193 isBlank = true and isEmpty = false
For character 8194 isBlank = true and isEmpty = false
For character 8195 isBlank = true and isEmpty = false
For character 8196 isBlank = true and isEmpty = false
For character 8197 isBlank = true and isEmpty = false
For character 8198 isBlank = true and isEmpty = false
For character 8200 isBlank = true and isEmpty = false
For character 8201 isBlank = true and isEmpty = false
For character 8202 isBlank = true and isEmpty = false
For character 8232 isBlank = true and isEmpty = false
For character 8233 isBlank = true and isEmpty = false
For character 8287 isBlank = true and isEmpty = false
For character 12288 isBlank = true and isEmpty = false