Checks whether a string is in all lower case - CSharp System

CSharp examples for System:String Case

Description

Checks whether a string is in all lower case

Demo Code


using System.Text.RegularExpressions;
using System.Text;
using System.Globalization;
using System.Collections.Generic;
using System;//from www . ja  v  a 2 s. com

public class Main{
        //Checks whether a string is in all lower case
        //word -> True
        //Word -> False
        public static bool IsLowerCase(string input)
        {
            for (int i = 0; i < input.Length; i++)
            {
                if (String.Compare(input.Substring(i, 1), input.Substring(i, 1).ToLower(), false) != 0)
                    return false;
            }
            return true;
        }
}

Related Tutorials