string str="sdfsdafdgfdgahgyt3ads";
Regex reg=new Regex("a");
 
str=reg.Replace(str,"6",1,str.IndexOf("a")+1);
 
str=reg.Replace(str,"5",1,str.IndexOf("a")+1);

解决方案 »

  1.   

        string ss = "asardriiosar";
              int i = 0;
              string sqs =new string( ss.Select(item =>
              {              if (item == 'r')
                  {
                      i++;
                      if (i == 2)
                      {
                          item = 'E';
                      }
                     else if(i==3)
                      {
                           item='p';
                       }
                  }
                  return item;
              }).ToArray());
      

  2.   

    Regex不能在WebService里启用,只好用循环+IndexOf来处理!