public static boolean isPunc(String str){
  if (str == null)   return false;
  str=str.trim();
  for (int i=0; i < str.length(); ++i) {
    char c=str.charAt(i);
    if (Character.isDigit(c) || Character.isLetter(c)) {
      return false;
    }
  }
  return true;
}

public static boolean isPunc ( String str ) { if ( str == null ) return false ; str = str . trim ( ) ; for ( int i = 0 ; i < str . length ( ) ; ++ i ) { char c = str . charAt ( i ) ; if ( Character . isDigit ( c ) || Character . isLetter ( c ) ) { return false ; } } return true ; }
checks if is punctuation .
