If you need to split the text by a carriage return and/or space character, you can use the following code sample:
string words = notesTextBox.Text;
words = words.Replace("\r\n", " ");
string[] splitWords = words.Split(new char[] { ' ' });
This will replace all the carriage returns with spaces, then split the text at each space. If you do what Moreno said and just add the '\r' and '\n' characters to the array, you will end up getting more split words in your array. You will have to try each way and see which best fits your needs.
string words = notesTextBox.Text;
string[] splitWords = words.Split(new char[] { ' ', '\r', '\n' });
modified on Monday, August 10, 2009 11:55 AM