Char.ToUpper : Char « System « C# / C Sharp by API






Char.ToUpper

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

}

   
    
  








Related examples in the same category

1.Char.IsControl
2.Char.IsDigit
3.Char.IsLetter
4.Char.IsLower
5.Char.IsPunctuation
6.Char.IsSeparator
7.Char.IsSymbol
8.Char.IsUpper
9.Char.IsWhiteSpace
10.Char.MaxValue
11.Char.MinValue
12.Char.Parse(String value)