System.StringExtensions.SplitAndTrim C# (CSharp) Method

SplitAndTrim() public static method

Splits a string into segments based on a given separator. The segments are trimmed and empty segments containing only white space are removed.
public static SplitAndTrim ( this input ) : string[]
input this The string to split.
return string[]
        public static string[] SplitAndTrim(this string input, params char[] separator)
        {
            if (input == null)
            {
                return new string[0];
            }

            return input.Split(separator).Select(x => x.Trim()).Where(x => !string.IsNullOrWhiteSpace(x)).ToArray();
        }
    }
StringExtensions