<script language="JavaScript"> <!-- function splitParam(value){ var arr = value.split("&"); var d = []; for(var i=0; i<arr.length; i++){ d[d.length] = arr[i].split("="); } return d; }var f = splitParam('auth=0&service=SUCC&verfiy_rlt=03&photo=YES&photot=1&photor=/photos'); alert(f[0][0]); alert(f[0][1]); //--> </script>
string b = @"auth=0&service=SUCC&verfiy_rlt=03&photo=YES&photot=1&photor=/photos"; string [] a = b.Split('='); for (int i=0;i<a.Length;i++) Console.WriteLine(a[i]);
trystring test = "auth=0&service=SUCC&verfiy_rlt=03&photo=YES&photot=1&photor=/photos"; string[] a = System.Text.RegularExpressions.Regex.Split(test, @"&[^=]*=");
<!--
function splitParam(value){
var arr = value.split("&");
var d = [];
for(var i=0; i<arr.length; i++){
d[d.length] = arr[i].split("=");
}
return d;
}var f = splitParam('auth=0&service=SUCC&verfiy_rlt=03&photo=YES&photot=1&photor=/photos');
alert(f[0][0]);
alert(f[0][1]);
//-->
</script>
string [] a = b.Split('=');
for (int i=0;i<a.Length;i++)
Console.WriteLine(a[i]);
string[] a = System.Text.RegularExpressions.Regex.Split(test, @"&[^=]*=");
private void Form1_Load(object sender, EventArgs e)
{
this.label1.Text = "";
Regex re = new Regex(@"\w*=");
string[] a = re.Split("auth=0&service=SUCC&verfiy_rlt=03&photo=YES&photot=1&photor=/photos");
foreach (string m in a)
{
this.label1.Text += m.ToString() + "\n";
}
}
---------------------------------------------
EMail:[email protected] 请给我一个与您交流的机会!
string tempStr="auth=0&service=SUCC&verfiy_rlt=03&photo=YES&photot=1&photor=/photos";
this.TextBox3.Text=tempStr;
char[] a=tempStr.ToCharArray();
int count=0;
foreach(char b in a)
{
if(b.ToString()=="=")
{
count+=1;
}
}
if(count!=0)
{
string[] str=new string[count];
string temp="";
int i=0;
do
{
tempStr=tempStr.Substring(tempStr.IndexOf("=")+1);
if(tempStr.IndexOf("&")>0)
{
temp=tempStr.Substring(0,tempStr.IndexOf("&"));
}
else
{
temp=tempStr.Substring(0,tempStr.Length);
}
str[i]=temp;
i++;
}
while(tempStr.IndexOf("=")>0); for(int j=0;j<count;j++)
{
this.TextBox4.Text=this.TextBox4.Text+str[j].ToString();
}
}运行应该是楼主要的结果