Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# C# Streams and Data Processing Parsing Data Reading Line By Line

Richard Külling
Richard Külling
9,465 Points

Why is this split(new char[]{' ', '\t'}) incorrect?

"Bummer! 'split(new char[]{' ', '\t'})' is incorrect"

...How comes that string[] words = "The quick brown fox jumped over the lazy dog".Split(new char[]{' ', '\t'}); doesn't do the job?

1 Answer

Steven Parker
Steven Parker
231,268 Points

The question says "Complete the following code to split the string by spaces into an array of strings."

I'll bet you were thinking "whitespace"; but since they are asking explicitly for spaces, it's not correct to include tabs as an additional delimiter. Also, since you only need to specify a single character, you can use a simpler form of the "Split" method.