code: public static String cleanSubOptions(String optionPrefix, Set<String> allowedSubOptions, String s) {
          StringBuilder sb = new StringBuilder();
          if (!s.startsWith(optionPrefix)) return "";
          StringTokenizer st = new StringTokenizer(s.substring(optionPrefix.length()), ",");
          while (st.hasMoreTokens()) {
              String o = st.nextToken();
              int p = o.indexOf('=');
              if (p>0) {
                  String key = o.substring(0,p);
                  String val = o.substring(p+1);
                  if (allowedSubOptions.contains(key)) {
                      if (sb.length() > 0) sb.append(',');
                      sb.append(key+"="+val);
                  }
              }
          }
          return sb.toString();
      }
docs: Clean out unwanted sub options supplied inside a primary option.
  For example to only had portfile remaining from:
  settings="--server:id=foo,portfile=bar"
  do settings = cleanOptions("--server:",Util.set("-portfile"),settings);
  now settings equals "--server:portfile=bar"
  
  @param optionPrefix The option name, including colon, eg --server:
  @param allowsSubOptions A set of the allowed sub options, id portfile etc.
  @param s The option settings string.