캐릭터 분석 및 변환 기능
"ctype.h" 라이브러리에 미리 정의된 함수는 문자 입력을 분석하고 변환하기 위한 것입니다.
분석 기능
| S.아니요 | 함수 | 설명 |
|---|---|---|
| 1 | 이알파() | 알파벳인지 아닌지 |
| 2 | isdigit() | 숫자 여부 |
| 3 | isspace() | 공백, 새 줄 또는 탭 |
| 4 | ispunct() | 특수 기호 여부 |
| 5 | 느린() | 알파벳의 소문자 |
| 6 | isupper() | 알파벳의 대문자 |
| 7 | 이문자숫자() | 알파벳/숫자 여부 |
변환 기능
| 함수 | 설명 |
|---|---|
| tolower() | 대문자를 소문자로 변환 |
| 토퍼() | 소문자 알파벳을 대문자로 변환 |
예시
문자 분석 및 변환 기능을 보여주는 프로그램을 보자 -
#include<stdio.h>
#include<ctype.h>
void main(){
//Initializing compile time character variable//
char variable = 'A';
//Reading User I/P//
//printf("Enter the character : ");
//scanf("%c",variable);
//Using character analysis function & printing O/p//
if (isalpha(variable)){
printf("The character entered is :%c, an alphabet",variable);
} else {
printf("The character entered is not an alphabet");
}
} 출력
The character entered is :A, an alphabet