I have a URL and I need to get the value of v from this URL.
Here is my URL: http://www.youtube.com/watch?v=_RCIP6OrQrE
Any useful and fruitful help is highly appreciated..
解决方案
I think the one of the easiest ways out would be to parse the string returned by URL.getQuery() as
public static Map getQueryMap(String query)
{
String[] params = query.split("&");
Map map = new HashMap();
for (String param : params)
{
String name = param.split("=")[0];
String value = param.split("=")[1];
map.put(name, value);
}
return map;
}
You can use the map returned by this function to retrieve the value keying in the parameter name.