All Letters Are Lowercase in String by LINQ - CSharp System

CSharp examples for System:String Case

Description

All Letters Are Lowercase 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;/*from  w  ww  .j a  v a 2 s. co m*/
using System.ComponentModel;
using System.Collections.Generic;
using System;

public class Main{
        public static bool AllLettersAreLowercase(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.IsLower(c));
      }
}

Related Tutorials