using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string s = "111aa222aa333aa444aa555";
string findStr = "aa";//删除找到的第一个aa
int startIndex = s.IndexOf(findStr);
if (-1 != startIndex)
{
s = s.Substring(0, startIndex) + s.Substring(startIndex + findStr.Length);
Console.WriteLine(s);
}
Console.ReadKey();
}
}
}
运行效果