27. 문자구조체
.NET프로그래밍/C# 3.5 SP1 2009. 8. 6. 11:32 |using System;
public class 문자구조체
{
public static void Main()
{
// 특정 문자에 대해서 숫자형인지, 기호인지 등을 판단
char c = '1';
Console.WriteLine(Char.IsDigit(c)); // True
Console.WriteLine(Char.IsLower(c)); // 소문자? false
Console.WriteLine("문자 하나 입력... _\b");
char data = Convert.ToChar(Console.ReadLine());
if (char.IsLower(data))
{
Console.WriteLine("소문자");
}
else if (Char.IsPunctuation(data))
{
Console.WriteLine("기호문자");
}
string s = "Abc";
if (Char.IsUpper(s, 0))
{
Console.WriteLine("첫자가 대문자군요...");
}
}
}
'.NET프로그래밍 > C# 3.5 SP1' 카테고리의 다른 글
29. 구조체를 이용한 카운트 알고리즘 (0) | 2009.08.06 |
---|---|
28. 열거형 (0) | 2009.08.06 |
26. 날짜관련구조체 (0) | 2009.08.06 |
25. Address 구조체 (0) | 2009.08.06 |
24. 구조체확장 (0) | 2009.08.06 |