using System; namespace StringSearch { class Tester { public void Run() { // Create some strings to work with string s1 = "http://www.bbc.co.uk"; string s2; string s3; int index; // Search for first substring s2 = s1.Substring( 0, 4); Console.WriteLine(s2); // Search for next substring index = s1.LastIndexOf("/"); s2 = s1.Substring(index + 1, 3); Console.WriteLine(s2); // Search for next substring index = s1.IndexOf("."); s2 = s1.Substring(index+1); s3 = s2.Substring(0, 3); Console.WriteLine(s3); // Search for next substring index = s2.IndexOf("."); s3 = s2.Substring(index + 1, 2); Console.WriteLine(s3); // Search for last substring index = s1.LastIndexOf("."); s3 = s1.Substring(index + 1, 2); Console.WriteLine(s3 + "\n"); } static void Main() { Tester t = new Tester(); t.Run(); Console.ReadLine(); } } }