Java URI to Parameter getQueryParameter(final String param, URI data)

Here you can find the source of getQueryParameter(final String param, URI data)

Description

get Query Parameter

License

Open Source License

Declaration

private static String getQueryParameter(final String param, URI data) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.net.URI;

public class Main {
    private static String getQueryParameter(final String param, URI data) {
        final String query = data.getQuery();
        String value = null;//from   w ww  .  j a v  a2s  . c o  m
        if (query != null && query.contains(param)) {
            String[] params = query.split("&");
            for (String p : params) {
                if (p.contains(param)) {
                    value = p.substring(p.indexOf("=") + 1, p.length());
                    break;
                }
            }
        }
        return value;
    }
}

Related

  1. getKey(URI uri)
  2. getParameters(URI uri)
  3. getParameters(URI uri)
  4. getQueryKeyValuePairs(URI uri)
  5. getQueryKeyValuePairs(URI uri)
  6. getQueryParameters(URI uri)
  7. getQueryParameters(URI uri)
  8. getQueryParameterValues(String uri, String name)