How to Extract Substring From a String in C#

This Program extracts Substring from a string in C# program. The program extract semicolon which occurred in string many times and in new string put all the alphabet of previous string except semicolon.

 

 Source Code 

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

namespace LEPPOST
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(" \t \t \t Programming Hub\n\n");
            String expression = "The; Hands; That; Rock; the Cradl;e Rules; The World;";
            String[] strExpression = expression.Split(';');
            foreach (String st in strExpression)
            {
                Console.Write(st);
            }
            Console.ReadKey();
        }
    }
}

Output of the Program

How to extract Substring From a String

Share on Google Plus

About Asad

Asad Niazi is Software Engineer , Programmer, Web Developer and a young mentor of BloggersTown and PProgramming. Asad Love to writes about Technology, Programming, Blogging and make money online.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment