Hi,
I have a string like this:
string myString = Part1#Part2#Part3;
I want to separate the string into an array by splitting via the '#' character.
When I try the following code, it works:
But I don't want to just loop through all array items, I want to return a value for just the second item in the array. e.g:Code:string myString = Part1#Part2#Part3; string[] myArray= myString.Split(new Char[] { '#' }); foreach (string myWord in myArray) { testbox1.Text += myWord + "<br />"; }
This just errors though.Code:string myString = Part1#Part2#Part3; string[] myArray= myString.Split(new Char[] { '#' }); testbox1.Text = "The second part of the array is: " + myArray[1] + "<br />";
How do I refer to an item in an array specifically, without looping through everything?
Thanks all!




Bookmarks