Friday 29 September 2017

remove whitespace from string in C#

public static string RemoveWhitespace(string input)
        {
            return new string(input.ToCharArray()
                .Where(c => !Char.IsWhiteSpace(c))
                .ToArray());
        }

No comments:

Post a Comment