C#의 Char.IsDigit() 메서드는 지정된 유니코드 문자가 10진수로 분류되는지 여부를 나타냅니다.
구문
다음은 구문입니다 -
public static bool IsDigit (char ch);
위에서 매개변수 ch는 평가할 유니코드 문자입니다.
예시
이제 Char.IsDigit() 메서드를 구현하는 예를 살펴보겠습니다. -
using System;
public class Demo {
public static void Main(){
bool res;
char val = 'g';
Console.WriteLine("Value = "+val);
res = Char.IsDigit(val);
Console.WriteLine("Is the value a digit? = "+res);
}
} 출력
이것은 다음과 같은 출력을 생성합니다 -
Value = g Is the value a digit? = False
예시
이제 다른 예를 살펴보겠습니다 -
using System;
public class Demo {
public static void Main(){
bool res;
char val = '2';
Console.WriteLine("Value = "+val);
res = Char.IsDigit(val);
Console.WriteLine("Is the value a digit? = "+res);
}
} 출력
이것은 다음과 같은 출력을 생성합니다 -
Value = 2 Is the value a digit? = True