METHOD

String.Split with RemoveEmptyEntries

Returns segments; RemoveEmptyEntries drops zero-length segments.

Formal Syntax & Structure

csharp syntaxcsharp
string[] Split(char separator, StringSplitOptions options)

Working Example

Example Snippetcsharp
System.Console.WriteLine("a  b".Split(' ', System.StringSplitOptions.RemoveEmptyEntries).Length);
C# & .NET Reference