private boolean isIdentifier(String s){
  if (s == null) {
    return false;
  }
  s=s.trim();
  if (s.length() > 0) {
    if (!Character.isLetter(s.charAt(0))) {
      return false;
    }
    for (int i=1; i < s.length(); i++) {
      final char ch=s.charAt(i);
      if (ch != '_' && ch != '-' && !Character.isLetterOrDigit(ch)) {
        return false;
      }
    }
  }
  return false;
}

private boolean isIdentifier ( String s ) { if ( s == null ) { return false ; } s = s . trim ( ) ; if ( s . length ( ) > 0 ) { if ( ! Character . isLetter ( s . charAt ( 0 ) ) ) { return false ; } for ( int i = 1 ; i < s . length ( ) ; i ++ ) { final char ch = s . charAt ( i ) ; if ( ch != '_' && ch != '-' && ! Character . isLetterOrDigit ( ch ) ) { return false ; } } } return false ; }
checks if given string is valid identifier .
