Extract part of a string between point A and B

后端 未结 5 1046
遥遥无期
遥遥无期 2020-12-16 12:02

I am trying to extract something from an email. The general format of the email will always be:

blablablablabllabla hello my friend.

[what I want]

Goodbye          


        
5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-16 12:35

    string s1 = "find a string between within a lengthy string";
    string s2 = s1.IndexOf("between").ToString();
    string output = s1.Substring(0, int.Parse(s2));
    Console.WriteLine("string before between is : {0}", output);
    Console.ReadKey();
    

提交回复
热议问题