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 Working with DateTime

Shadab Khan
Shadab Khan
5,470 Points

Please explain me the concept of - StringSplitOptions.None - when splitting a string

Hi, If somebody understands this better, can they please explain me the exact use of the StringSplitOptions.None enum when splitting a string. An example for explanation will be great. Thanks very much in advance.

2 Answers

Steven Parker
Steven Parker
229,786 Points

The option "StringSplitOptions.None" is the default, which means that if two of your specified delimiter are next to each other, you'll get an element in the array that contains an empty string. The alternative choice is "StringSplitOptions.RemoveEmptyEntries", which means that a delimiter next to another will be disregarded, and you'll only get array elements that have non-empty contents.

There's more details and several code examples on this MDN page: StringSplitOptions Enumeration.

Shadab Khan
Shadab Khan
5,470 Points

Thank you, Steven. Much appreciated.