![技术小学生微信公众号 技术小学生微信公众号](/d/file/p/2023/11-06/384a0f88dc69e6f0b9276fec739fb818.png)
![腾讯云服务器大促销。](/d/file/p/2023/06-06/8f2af9e8846e4a93cc2a3890462510dc.png)
![华为服务器](/d/file/p/2023/07-25/08518ffe66f6cea5a59993d8b8d33b96.jpg)
string stra = "abcdefghijk";
string strtempa = "c";
string strtempb = "j";
//我们要求c---g之间的字符串,也就是:defghi
//求得strtempa 和 strtempb 出现的位置:
int IndexofA = stra.IndexOf(strtempa);
int IndexofB = stra.IndexOf(strtempb);
string Ru = stra.Substring(IndexofA + 1, IndexofB - IndexofA -1);
Console.WriteLine("Ru = " + Ru); //----这就是你要的结果
Console.ReadLine();
![技术小学生微信公众号 技术小学生微信公众号](/d/file/p/2023/11-06/384a0f88dc69e6f0b9276fec739fb818.png)
![华为服务器](/d/file/p/2023/07-25/08518ffe66f6cea5a59993d8b8d33b96.jpg)
![腾讯云服务器大促销。](/d/file/p/2023/06-06/8f2af9e8846e4a93cc2a3890462510dc.png)
亲爱的:若该文章解决了您的问题,可否收藏+评论+分享呢?
文章评论 本文章有个评论