public static QueryString decode(final String s) {
    final QueryString params = new QueryString();
    String name = null;
    int pos = 0; // Beginning of the unprocessed region
    int i;       // End of the unprocessed region
    for (i = 0; i < s.length(); i++) {
      final char c = s.charAt(i);
      if (c == '=' && name == null) {
        if (pos != i) {
          name = s.substring(pos, i);
        }
        pos = i + 1;
      } else if (c == '&') {
        if (name == null && pos != i) {
          // We haven't seen an `=' so far but moved forward.
          // Must be a param of the form '&a&' so add it with
          // an empty value.
          params.add(s.substring(pos, i), "");
        } else if (name != null) {
          params.add(name, s.substring(pos, i));
          name = null;
        }
        pos = i + 1;
      }
    }

    if (pos != i) {  // Are there characters we haven't dealt with?
      if (name == null) {     // Yes and we haven't seen any `='.
        params.add(s.substring(pos, i), "");
      } else {                // Yes and this must be the last value.
        params.add(name, s.substring(pos, i));
      }
    } else if (name != null) {  // Have we seen a name without value?
      params.add(name, "");
    }

    return params;
  }
public static QueryString decode ( final String s ) { final QueryString params = new QueryString ( ) ; String name = null ; int pos = 0 ; int i ; for ( i = 0 ; i < s . length ( ) ; i ++ ) { final char c = s . charAt ( i ) ; if ( c == '=' && name == null ) { if ( pos != i ) { name = s . substring ( pos , i ) ; } pos = i + 1 ; } else if ( c == '&' ) { if ( name == null && pos != i ) { params . add ( s . substring ( pos , i ) , "" ) ; } else if ( name != null ) { params . add ( name , s . substring ( pos , i ) ) ; name = null ; } pos = i + 1 ; } } if ( pos != i ) { if ( name == null ) { params . add ( s . substring ( pos , i ) , "" ) ; } else { params . add ( name , s . substring ( pos , i ) ) ; } } else if ( name != null ) { params . add ( name , "" ) ; } return params ; }
Returns the decoded key-value parameter pairs of the URI.