string str = textBox1.Text;
StringBuilder sb = new StringBuilder(str);
sb.Replace("proxy=","*");
string[] sArray2 = str.Split(new char[2] { ‘*‘, ‘&‘ });//字符串切割
foreach (string i in sArray2)
{
string url = i.ToString();
string result = System.Web.HttpUtility.UrlDecode(url);
str = str.Replace(url, result);
}
string[] sArray = str.Split(new char[2] { ‘=‘, ‘&‘ });//字符串切割
bool temp=true;
foreach (string i in sArray)
{
if (temp)
{ textBox2.Text = textBox2.Text + "‘" + i.ToString() + "‘:"; temp = false; }
else
{ textBox2.Text = textBox2.Text + i.ToString()+"‘,\r\n"; temp = true; }
}
}
思路差不多,但是切割字符串的效率比调用Regex快太多,特别是大数据的时候