Answers for "String Split Remove Empty Entries"

C#
0

String Split Remove Empty Entries

string s = "You win some. You lose some.";
char[] separators = new char[] { ' ', '.' };

string[] subs = s.Split(separators, StringSplitOptions.RemoveEmptyEntries);

foreach (var sub in subs)
{
    Console.WriteLine($"Substring: {sub}");
}

// This example produces the following output:
//
// Substring: You
// Substring: win
// Substring: some
// Substring: You
// Substring: lose
// Substring: some
Posted by: Guest on August-24-2021

Code answers related to "String Split Remove Empty Entries"

C# Answers by Framework

Browse Popular Code Answers by Language