code: public static String quoteNameIfNecessary(String name) {
          int len = name.length();
  
          for (int i = 0; i < len; i++) {
              char c = name.charAt(i);
  
              if (! ((c >= 'A' && c <= 'Z') ||
                     (c >= 'a' && c <= 'z') ||
                     (c == ' ') ||
                     (c >= '0' && c <= '9'))) {
                  return '"' + quoteName(name) + '"';
              }
          }
  
          return name;
      }
docs: Returns the name, conservatively quoting it if there are any
  characters that are likely to cause trouble outside of a
  quoted string, or returning it literally if it seems safe.