C# C# Streams and Data Processing Parsing Data Working with DateTime

Shadab Khan
Shadab Khan
4,985 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
163,772 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
4,985 Points

Thank you, Steven. Much appreciated.