Monday, 5 December 2016

Find all possible sub strings of a string

        static void Main(string[] args)
        {
            string value = Console.ReadLine();
            // Avoid full length.
            for (int length = 1; length < value.Length; length++)
            {
                // End index is tricky.
                for (int start = 0; start <= value.Length - length; start++)
                {
                    string substring = value.Substring(start, length);
                    Console.WriteLine(substring);
                }
            }
            Console.ReadLine();

        }

1 comment:

  1. Come and read us!! We are the No 1 AngularJS Training providers in Chennai. We are teaching how to be AngularJS Ninjas!!! That's right! - Our AngularJS Course Training was designed in a way which helps both freshers and professionals. Book your FREE DEMO Session now @ Credo Systemz angularjs training

    ReplyDelete

Note: only a member of this blog may post a comment.