Friday, June 3, 2011

String splitter function using C#

You can use following function to Split String using C#.

public static Queue StringSplitter(string MainString, string SplitBy)
{
    Queue Q = new Queue();
    foreach (string S in Regex.Split(MainString, SplitBy))
        if (S.Length > 0)
            Q.Enqueue(S);
    return Q;
}