/*
C#: The Complete Reference
by Herbert Schildt
Publisher: Osborne/McGraw-Hill (March 8, 2002)
ISBN: 0072134852
*/
// Demonstrate several Char methods.
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);
}
}