I have an array of strings, each element of the array contains a date and a last name, separated by a single space. For example the array at position 1 contains "12/10/2012 Smith" I simply need the date for each position in the array. Can I do this using Substring()? Or does that not work for arrays?
for(int i = 0; i < array.Length; i++) {
if(array[i] == ' ') {
array[i].Substring(0, i);
}
Console.WriteLine (array[i]);
}
This doesn't work. Do I need to somehow look at each of the characters in the array to use Substring()?