how to store multiple values seperated by commas in arrays?
arrays
Collapse
X
-
If what you want to do is create an array from a string like this:
all you would need to do is:Code:string arrayValues = "value1, value2, value3, value4";
You can provide any character(s) as delimiter in this part of the code:Code:string arrayValues = "value1, value2, value3, value4"; string[] newArray = arrayValues.Split(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:new char[]{','}
and it would give you the same array as result.Code:string arrayValues = "value1, value2; value3: value4"; string[] newArray = arrayValues.Split(new char[] { ',', ';', ':' };Comment
Comment