25 December 2013

C# program to show how to use Split method

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            String[] strOP;
            String str;
            char[] ch = { ' ', ',', ';', '|' };
            Console.WriteLine("Enter the String");
            str = Console.ReadLine();
            strOP = str.Split(ch);
            foreach (String obj in strOP)
                Console.WriteLine(obj.ToString());
            Console.ReadLine();
        }
    }
}






No comments:

Post a Comment