Check if a character is a upper case in CSharp
Description
The following code shows how to check if a character is a upper case.
Example
using System; /*ww w. ja v a2 s .c o m*/
class MainClass {
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.IsLower(str[i]))
Console.Write(" lowercase");
if(Char.IsUpper(str[i]))
Console.Write(" uppercase");
Console.WriteLine();
}
}
}
The code above generates the following result.