Results 1 to 3 of 3

Thread: Split String

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2004
    Posts
    97

    Split String

    Hello Everybody:
    I have a string called

    CIC Server kshah|345678 StatusChange PhoneStatus Change.

    How do I use the String.Split method so that the entire string splits and get stored in an array as:

    xmlarry[0]=CIC Server
    xmlarry[1]=kshah|345678
    xmlarry[2]=StatusChange
    xmlarry[3]=PhoneStatus Change

    Pls guide...

    Thanks,

    Rahil

  2. #2
    Lively Member JAtkinson's Avatar
    Join Date
    Feb 2004
    Location
    Richmond, VA
    Posts
    68
    It doesnt look like your string has any delimiters. Here is a link that may help you.

    http://msdn.microsoft.com/library/de...SplitTopic.asp
    Visual Studio .net 2003 EA
    VB .net
    C#

  3. #3
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Here is a working example that should get you rollin'

    Code:
    static void Main(string[] args)
    {
        string s = "CIC Server kshah|345678 StatusChange PhoneStatus Change";			
        string[] split = s.Split('|');
    
        foreach (string z in split)
        {
            Console.WriteLine(z + "\n");
        }
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width