using System; namespace StringSearch { class Tester { public void Run() { // Create some strings to work with string s1 = "http://www.bbc.co.uk"; // Constants for the space and comma characters const char Space = '/'; const char Stop = '.'; const char Colon = ':'; // Array of delimiters to split the sentence with char[] delimiters = new char[] { Space, Stop, Colon }; string output = ""; int ctr = 1; // Split the string and then iterate over the // resulting array of strings String[] resultArray = s1.Split(delimiters); foreach (String subString in resultArray) { if (subString != "") { output += ctr++; output += ": "; output += subString; output += "\n"; } } Console.WriteLine(output); } static void Main() { Tester t = new Tester(); t.Run(); Console.ReadLine(); } } }