J
John Salerno
This is an example in the book I'm reading:
string fullName = " Edward C Koop ";
fullName = fullName.Trim();
string[] names = fullName.Split(' ');
string firstName = names[0]; // Edward
Two questions about this:
1. Why do you use single quotes with Split() instead of double? Is this
necessary?
2. Would this parse the last name, since Trim() took out the trailing
space? Isn't Split() only looking for spaces following the separate
elements (words) of the string?
string fullName = " Edward C Koop ";
fullName = fullName.Trim();
string[] names = fullName.Split(' ');
string firstName = names[0]; // Edward
Two questions about this:
1. Why do you use single quotes with Split() instead of double? Is this
necessary?
2. Would this parse the last name, since Trim() took out the trailing
space? Isn't Split() only looking for spaces following the separate
elements (words) of the string?