Friday, 16 October 2015

Split a string array in C#

using System;
class Program
{
    static void Main()
    {
        string str = "India is my country";
        string[] splitArray = str.Split();
        foreach (string s in splitArray)
        {
            Console.WriteLine(s);
        }
    }
}


/*
Output :-

 India
 is
 my
 country
*/

No comments:

Post a Comment