using System;
using System.Linq;
namespace ExcludeEmptyArrayNullValues
{
class Program
{
static void Main(string[] args)
{
string _stringS1 = "How to exclude empty array null values while using string Split Method";
string[] _stringArray = _stringS1.Split(' ');
foreach (string item in _stringArray)
{
Console.WriteLine(item);
}
Console.WriteLine(Environment.NewLine);
char[] charSeparators = new char[] { ' ' };
_stringArray = _stringS1.Split(charSeparators, StringSplitOptions.RemoveEmptyEntries).ToArray();
foreach (string item in _stringArray)
{
Console.WriteLine(item);
}
Console.Read();
}
}
}
No comments:
Post a Comment