All Letters Are Uppercase in String by LINQ - CSharp System

CSharp examples for System:String Case

Description

All Letters Are Uppercase in String by LINQ

Demo Code


using System.Text.RegularExpressions;
using System.Text;
using System.Runtime.InteropServices;
using System.Reflection;
using System.Linq;
using System.IO;//w w  w.j  a  v  a 2s.  c  o m
using System.ComponentModel;
using System.Collections.Generic;
using System;

public class Main{
        public static bool AllLettersAreUppercase(this string s)
      {
         //for (int i = 0; i < s.Length; i++)
         //{
         //   if (Char.IsLetter(s[i]) && !Char.IsUpper(s[i]))
         //      return false;
         //}
         return s.All(c => !Char.IsLetter(c) || Char.IsUpper(c));
      }
}

Related Tutorials