cdm/src/main/java/ucar/nc2/iosp/netcdf3/N3iosp.java
public static boolean isValidNetcdfObjectName(String name) {
    if (name == null || name.isEmpty()) {  // Null and empty names disallowed
      return false;
    }

    int cp = name.codePointAt(0);

    // First char must be [a-z][A-Z][0-9]_ | UTF8
    if (cp <= 0x7f) {
      if (!('A' <= cp && cp <= 'Z')
              && !('a' <= cp && cp <= 'z')
              && !('0' <= cp && cp <= '9')
              && cp != '_') {
        return false;
      }
    }

    for (int i = 1; i < name.length(); ++i) {
      cp = name.codePointAt(i);

      // handle simple 0x00-0x7f characters here
      if (cp <= 0x7f) {
        if (cp < ' ' || cp > 0x7E || cp == '/') {  // control char, DEL, or forward-slash
          return false;
        }
      }
    }

    if (cp <= 0x7f && Character.isWhitespace(cp)) {  // trailing spaces disallowed
      return false;
    }

    return true;
  }
public static boolean isValidNetcdfObjectName(String name) {
    if (name == null || name.isEmpty()) {  // Null and empty names disallowed
      return false;
    }

    int cp = name.codePointAt(0);

    // First char must be [a-z][A-Z][0-9]_ | UTF8
    if (cp <= 0x7f) {
      if (!('A' <= cp && cp <= 'Z')
              && !('a' <= cp && cp <= 'z')
              && !('0' <= cp && cp <= '9')
              && cp != '_') {
        return false;
      }
    }

    for (int i = 1; i < name.length(); ++i) {
      cp = name.codePointAt(i);

      // handle simple 0x00-0x7f characters here
      if (cp <= 0x7f) {
        if (cp < ' ' || cp > 0x7E || cp == '/') {  // control char, DEL, or forward-slash
          return false;
        }
      }
    }

    if (cp <= 0x7f && Character.isWhitespace(cp)) {  // trailing spaces disallowed
      return false;
    }

    return true;
  }
public static boolean isValidNetcdfObjectName ( String name ) { if ( name == null || name . isEmpty ( ) ) { // Null and empty names disallowed return false ; } int cp = name . codePointAt ( 0 ) ; // First char must be [a-z][A-Z][0-9]_ | UTF8 if ( cp <= 0x7f ) { if ( ! ( ' ' <= cp && cp <= ' ' ) && ! ( ' ' <= cp && cp <= ' ' ) && ! ( ' ' <= cp && cp <= ' ' ) && cp != ' ' ) { return false ; } } for ( int i = 1 ; i < name . length ( ) ; ++ i ) { cp = name . codePointAt ( i ) ; // handle simple 0x00-0x7f characters here if ( cp <= 0x7f ) { if ( cp < ' ' || cp > 0x7E || cp == ' ' ) { // control char, DEL, or forward-slash return false ; } } } if ( cp <= 0x7f && Character . isWhitespace ( cp ) ) { // trailing spaces disallowed return false ; } return true ; }
Should match makeValidNetcdfObjectName()
Should match makeValidNetcdfObjectName ()