code: public static boolean isWhitespace(String str) {
      if ("\u0002".equals(str) // unbreakable field, e.g. a footnote number in OOo
          || "\u0001".equals(str)) { // breakable field in OOo
        return false;
      }
      String trimStr = str.trim();
      if (isEmpty(trimStr)) {
        return true;
      }
      if (trimStr.length() == 1) {
        if ("\u200B".equals(str)) {
          // We need u200B​​ to be detected as whitespace for Khmer, as it was the case before Java 7.
          return true;
        } else if ("\u00A0".equals(str) || "\u202F".equals(str)) {  // non-breaking space and narrow non-breaking space
          return true;
        }
        return Character.isWhitespace(trimStr.charAt(0));
      }
      return false;
    }
docs: Checks if a string contains a whitespace, including:
  <ul>
  <li>all Unicode whitespace
  <li>the non-breaking space (U+00A0)
  <li>the narrow non-breaking space (U+202F)
  <li>the zero width space (U+200B), used in Khmer
  </ul>
  @param str String to check
  @return true if the string is a whitespace character