Click here to Skip to main content
15,878,231 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have to access tha stock data and split data using split function.
have to split is that possible?
or help me to find a solution.
Posted

You have System.String.Split or System.Text.RegularExpressions.Regex.Split, which can be used for string split.
 
Share this answer
 
use the Sting.Split() function with the delimeter and it returns a string array.
 
Share this answer
 
go through this

http://msdn.microsoft.com/en-us/library/b873y76a.aspx[^]

Example
C#
string s = "there is a cat";
    //
    // Split string on spaces.
    // ... This will separate all the words.
    //
    string[] words = s.Split(' ');
    foreach (string word in words)
    {
        Console.WriteLine(word);
    }
 
Share this answer
 
v2
Comments
Nagy Vilmos 22-Jul-11 3:21am    
Strike Two! That's the second link removed. Another one and you'll get hit by the spam hammer.
It might help you,

C#
namespace StringSplitTest
{
    using System.Text.RegularExpressions;
    class Program
    {
        static void Main(string[] args)
        {
            var splittedData = SplitData("I!am!a!string", new[] { "!" });
            var splittedDataUsingRegex = SplitDataUsingRegularExpression("I!am!a!string", "!");
        }

        public static string[] SplitData(string dataToSplit, string[] separator)
        {
            return dataToSplit.Split(separator, System.StringSplitOptions.None);
        }

        public static string[] SplitDataUsingRegularExpression(string dataToSplit, string pattern)
        {
            return Regex.Split(dataToSplit, pattern);
        }
    }
}


:)
 
Share this answer
 
You may use this
public string[] SplitData(string s,char separator)
{
 return s.Split(separator);
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900