Thursday, December 17, 2015

Split a string on spaces in C#.

I'm doing it like this...

char space = ' ';
string[] words = poem.Split(space).ToArray();

 
 

...but, this thinks I should do this..

char[] space = new char[] { ' ', '\t' };

 
 

...as the \t will address "whitespace"

No comments:

Post a Comment