arrays

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • waterfall
    New Member
    • Dec 2007
    • 22

    arrays

    how to store multiple values seperated by commas in arrays?
  • radcaesar
    Recognized Expert Contributor
    • Sep 2006
    • 759

    #2
    cant u able to do that in array of string ?

    Comment

    • Phad Mi Jet
      New Member
      • Jan 2008
      • 1

      #3
      If what you want to do is create an array from a string like this:
      Code:
      string arrayValues = "value1, value2, value3, value4";
      all you would need to do is:

      Code:
      string arrayValues = "value1, value2, value3, value4";
      string[] newArray = arrayValues.Split(new char[]{','});
      You can provide any character(s) as delimiter in this part of the code:
      Code:
      new char[]{','}
      It's basically an array of char with all the characters to split on, so for example, you could do this as well:

      Code:
      string arrayValues = "value1, value2; value3: value4";
      string[] newArray = arrayValues.Split(new char[] { ',', ';', ':' };
      and it would give you the same array as result.

      Comment

      Working...