code: public static String[] IDtoSTV(String id) {
          String source = ANY;
          String target = null;
          String variant = "";
          
          int sep = id.indexOf(TARGET_SEP);
          int var = id.indexOf(VARIANT_SEP);
          if (var < 0) {
              var = id.length();
          }
          boolean isSourcePresent = false;
          
          if (sep < 0) {
              // Form: T/V or T (or /V)
              target = id.substring(0, var);
              variant = id.substring(var);
          } else if (sep < var) {
              // Form: S-T/V or S-T (or -T/V or -T)
              if (sep > 0) {
                  source = id.substring(0, sep);
                isSourcePresent = true;
              }
              target = id.substring(++sep, var);
              variant = id.substring(var);
          } else {
              // Form: (S/V-T or /V-T)
              if (var > 0) {
                  source = id.substring(0, var);
                  isSourcePresent = true;
              }
              variant = id.substring(var, sep++);
              target = id.substring(sep);
          }
  
          if (variant.length() > 0) {
              variant = variant.substring(1);
          }
          
          return new String[] { source, target, variant,
                                isSourcePresent ? "" : null };
      }
docs: Parse an ID into pieces.  Take IDs of the form T, T/V, S-T,
  S-T/V, or S/V-T.  If the source is missing, return a source of
  ANY.
  @param id the id string, in any of several forms
  @return an array of 4 strings: source, target, variant, and
  isSourcePresent.  If the source is not present, ANY will be
  given as the source, and isSourcePresent will be null.  Otherwise
  isSourcePresent will be non-null.  The target may be empty if the
  id is not well-formed.  The variant may be empty.