Results 1 to 2 of 2

Thread: String Split [RESOLVED]

Threaded View

  1. #1

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    String Split [RESOLVED]

    I am using following function to split string into array.

    Code:
    private string[] SplitData(string DataValue)
    {
                 string Separator = "[::]";
                 string [] split = null;
    			
    	split = DataValue.Split(Separator.ToCharArray());
    			
                 return split;
    
    }
    If I use single character delimiter, code works fine, but for this delimiter, split gets some empty string values. I am calling the function like this.

    Code:
    string [] data = SplitData("Lahore[::]Karachi[::]Islamabad[::]Hyderabad");
    for(int i=0;i<=data.Length-1;i++)
            MessageBox.Show(data[i]);
    Last edited by usamaalam; Feb 7th, 2005 at 04:21 AM.

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