Saturday, 22 March 2014

How to split string in c# ?

Split means to separate the value to separate the values of string and form array and make it to array value and some time we want to make the array to string value.
Split string into c# to array; suppose you have the string as like Xx Yy Zz,  There  you can split and get the value into array “Xx” “Yy” and “Zz”
Code Snippet  for split string in C#
namespace testSplitString
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = "Split string to array"; // string value with space
           
            string[] strSplitValue = str.Split(' '); // split strinf itnto array.
            foreach (string oStr in strSplitValue)
            {
                Console.WriteLine(oStr); // display array valye
            }
        }
    }
}
@Out split  value 
click here to get how to Convert array to string

No comments:

Post a Comment

Others

You will like to read it