namespace  找到一段话中第二个关键字的位置

{
    class Program
    {
        static void Main(string[] args)
        {     //找第二个a
            string s = "cabcaceadf";
            int n = s.IndexOf("a");  //找到第一个a的索引n
            string x = s.Substring(n+1);  //从a的索引的位置以后开始截取,截取的数量为第一个a的索引后的所有数
            int m = x.IndexOf("a");   //重新找a的索引m
           Console.WriteLine(m);
           Console.ReadLine();
        }
    }
}

相关文章:

  • 2022-01-20
  • 2022-12-23
  • 2021-11-08
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2021-07-15
  • 2021-05-31
猜你喜欢
  • 2022-01-30
  • 2022-12-23
  • 2022-02-12
  • 2022-12-23
  • 2022-01-11
  • 2021-10-23
  • 2021-11-15
相关资源
相似解决方案