public static string getQueryString(string url, string name)
{
if (url == "") return "";
System.Text.RegularExpressions.Regex re = new System.Text.RegularExpressions.Regex(@"(^|&)?(\w+)=([^&]+)(&|$)?", System.Text.RegularExpressions.RegexOptions.Compiled);
System.Text.RegularExpressions.MatchCollection mc = re.Matches(url);
foreach (System.Text.RegularExpressions.Match m in mc)
{
if (m.Result("$2").Equals(name))
{
return m.Result("$3");
}
}
return "";
}
上面是C#的代码,用Java代码怎么写?