Remove whitespace chars. - CSharp System

CSharp examples for System:String Strip

Description

Remove whitespace chars.

Demo Code


using System.Text.RegularExpressions;
using System.Reflection;
using System.Linq.Expressions;
using System.Linq;
using System.Collections.Generic;
using System.Collections;
using System;/*from   w  w  w  .j  a v a  2  s  .co  m*/

public class Main{
        /// <summary>
        /// Remove whitespace chars.
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public static string StripWhitespace(this string input)
        {
            return Regex.Replace(input, @"\s+", "");
        }
}

Related Tutorials