Whether the all string is upper cased, ie whether all the letters in the string are upper cased - CSharp System

CSharp examples for System:String Case

Description

Whether the all string is upper cased, ie whether all the letters in the string are upper cased

Demo Code


using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.Text;
using System.Net.Mail;
using System.Linq;
using System.Globalization;
using System.Collections.Generic;
using System;/*from   www  .  j a  v  a2  s . c  o  m*/

public class Main{
        /// <summary>
        /// Whether the all string is upper cased, 
        /// ie whether all the letters in the string are upper cased
        /// </summary>
        public static bool IsAllUpperCased(string input)
        {
            if (string.IsNullOrEmpty(input)) { return false; }

            return input.Where(char.IsLetter).All(char.IsUpper);
        }
}

Related Tutorials