110,537
社区成员
发帖
与我相关
我的任务
分享
string[] sT =
{
"",
"p=1" ,
"ID=e2798a59&xx=79d5&bb=4833-9c57&cc=87d46a8&bb=b907a" ,
"ID=e2798a59&xx=79d5&bb=4833-9c57&cc=87d46a8&bb=b907a&p=2" ,
"ID=e2798a59&xx=79d5&p=4&bb=4833-9c57&cc=87d46a8&bb=b907a"
};
const string sIni = "p=0";
const string sReg = @"\bp=(?<a>\d+)";
System.Text.RegularExpressions.Regex reT = new System.Text.RegularExpressions.Regex(sReg);
for (Int32 I = 0; I < sT.Length; I++)
{
if (sT[I].Length > 0)
{
System.Text.RegularExpressions.MatchCollection mcT = reT.Matches(sT[I]);
if (mcT.Count > 0)
{
Int32 J = Int32.Parse(mcT[0].Groups["a"].Value) + 1;
sT[I] = sT[I].Replace(mcT[0].Value, "p=" + J.ToString());
}
else
{
sT[I] = sT[I] + "&" + sIni;
}
}
else
{
sT[I] = sIni;
}
System.Console.WriteLine(sT[I]);