Results 1 to 3 of 3

Thread: array from string

  1. #1

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    array from string

    I have a string :

    "asasa,bbbbb.ccccc"

    I need to split these elements up and place into a string array but I have no idea how many items may appear in the list.

    The above string contains 3 elements but may contain 40.

    Any idea how I split this up into an array ?

    Thanks in Advance

    Parksie

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: array from string

    String.Split is overloaded. It allows you to specify multiple delimiters.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: array from string

    Code:
    string s={"aaasab,aseder,fg5trgf,fgrtyr.rfgret"};
    char[] delim={',','.'};
    s.Split(delim);//This is the array of results
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

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