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






Char.IsDigit

  
using System;  
  
public class CharDemo {     
  public static void Main() {     
    string str = "This is a test. $23"; 
    int i; 
 
    for(i=0; i < str.Length; i++) { 
      Console.Write(str[i] + " is"); 
      if(Char.IsDigit(str[i])) 
        Console.Write(" digit"); 
      if(Char.IsLetter(str[i])) 
        Console.Write(" letter"); 
      if(Char.IsLower(str[i])) 
        Console.Write(" lowercase"); 
      if(Char.IsUpper(str[i])) 
        Console.Write(" uppercase"); 
      if(Char.IsSymbol(str[i])) 
        Console.Write(" symbol"); 
      if(Char.IsSeparator(str[i])) 
        Console.Write(" separator"); 
      if(Char.IsWhiteSpace(str[i])) 
        Console.Write(" whitespace"); 
      if(Char.IsPunctuation(str[i])) 
        Console.Write(" punctuation"); 
 
      Console.WriteLine(); 
    } 
 
    Console.WriteLine("Original: " + str); 
 
    // Convert to upper case.    
    string newstr = ""; 
    for(i=0; i < str.Length; i++) 
      newstr += Char.ToUpper(str[i]); 
  
    Console.WriteLine("Uppercased: " + newstr); 
 
  }     
}

   
    
  








Related examples in the same category

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