Checks if string is nothing but spaces - CSharp System

CSharp examples for System:String Parse

Description

Checks if string is nothing but spaces

Demo Code


using System.Text.RegularExpressions;
using System.Text;
using System.Globalization;
using System.Collections.Generic;
using System;//ww w .  ja  v a 2s  .c  o m

public class Main{
        //Checks if string is nothing but spaces
        //"        " -> True
        public static bool IsSpaces(string input)
        {
            if (input.Length == 0) return false;
            return input.Replace(" ", "").Length == 0;
        }
}

Related Tutorials