How to find all possible substring of a given string?


How to find all possible substring of a given string?


  public void PossibleString(String x)
        {
            char[] arr = x.ToCharArray();
            int leng = arr.Length;
            string rev="";
            for (int i = 0; i<= arr.Length-1;  i++)
            {
                rev  = rev + arr[i].ToString();
                Console.Write(rev + " ");
            }
           
         }
        static void Main(string[] args)
        {
            Program p1 = new Program();
         Console.WriteLine(" How to find all possible substring of a given string ? \n");
            p1.PossibleString("shivKumar");
            Console.ReadLine();
        }


OUTPUT:
How to find all possible substring of a given string ?
s sh shi shiv shivK shivKu shivKum shivKuma shivKumar





Share:

No comments:

Post a Comment

Popular

Tags

Mobile

Recent Posts