Mega Code Archive

 
Categories / C# / Data Types
 

Is a char in a range Exclusively

using System; using System.Data; using System.Text.RegularExpressions; using System.Text; class Class1{         static void Main(string[] args){             Console.WriteLine(IsInRangeExclusive('c', 'c', 'g'));             Console.WriteLine(IsInRangeExclusive('c', 'c', 'g'));             Console.WriteLine(IsInRangeExclusive((char)32, (char)31, 'Z'));         }     public static bool IsInRangeExclusive(char testChar, char startOfRange, char endOfRange)     {       if (testChar > startOfRange && testChar < endOfRange)       {         // testChar is within the range         return (true);       }       else       {         // testChar is NOT within the range          return (false);       }     } }