C - ctype
ctype.h ये header file character पर नियंत्रण रखने के लिए बनाया गया है |
Library Functions | Description |
---|---|
isalnum() | ये character alphanumeric है या नहीं ये check किया जाता है | |
isalpha() | ये character alphabetic है या नहीं ये check किया जाता है | |
iscntrl() | ये character control character है या नहीं ये check किया जाता है | |
isdigit() | ये character digit है या नहीं ये check किया जाता है | |
isgraph() | ये character graphical character है या नहीं ये check किया जाता है | |
islower() | ये character lowercase है या नहीं ये check किया जाता है | |
ispunct() | ये character puctuationn है या नहीं ये check किया जाता है | |
isspace() | ये character space है या नहीं ये check किया जाता है | |
isupper() | ये character uppercase है या नहीं ये check किया जाता है | |
isxdigit() | ये character hexadecimal है या नहीं ये check किया जाता है | |
tolower() | ये character uppercase से lowercase में convert किया जाता है | |
toupper() | ये character lowercase से uppercase में convert किया जाता है | |
isalnum : Alphanumeric
Source Code :Output :#include <stdio.h> #include <ctype.h> int main(){ char i; i = '1'; if(isalnum(i)){ printf("%c is alphanumeric.\n", i); }else{ printf("%c is not alphanumeric.\n", i); } i = 'H'; if(isalnum(i)){ printf("%c is alphanumeric.\n", i); }else{ printf("%c is not alphanumeric.\n", i); } i = '$'; if(isalnum(i)){ printf("%c is alphanumeric.\n", i); }else{ printf("%c is not alphanumeric.\n", i); } return 0; }
1 is alphanumeric. H is alphanumeric. $ is not alphanumeric.
isalpha : Alphanumeric
Source Code :Output :#include <stdio.h> #include <ctype.h> int main(){ char i; i = '1'; if(isalpha(i)){ printf("%c is alphabetic.\n", i); }else{ printf("%c is not alphabetic.\n", i); } i = 'H'; if(isalpha(i)){ printf("%c is alphabetic.\n", i); }else{ printf("%c is not alphabetic.\n", i); } i = '$'; if(isalpha(i)){ printf("%c is alphabetic.\n", i); }else{ printf("%c is not alphabetic.\n", i); } return 0; }
1 is not alphabetic. H is alphabetic. $ is not alphabetic.
iscntrl : Alphanumeric
Source Code :Output :#include <stdio.h> #include <ctype.h> int main(){ char i; i = '1'; if(iscntrl(i)){ printf("%c is control character.\n", i); }else{ printf("%c is not control character.\n", i); } i = 'H'; if(iscntrl(i)){ printf("%c is control character.\n", i); }else{ printf("%c is not control character.\n", i); } i = '$'; if(iscntrl(i)){ printf("%c is control character.\n", i); }else{ printf("%c is not control character.\n", i); } i = '\t'; if(iscntrl(i)){ printf("%c is control character.\n", i); }else{ printf("%c is not control character.\n", i); } return 0; }
1 is not control character. H is not control character. $ is not control character. is control character.
isdigit : Alphanumeric
Source Code :Output :#include <stdio.h> #include <ctype.h> int main(){ char i; i = '1'; if(isdigit(i)){ printf("%c is digit.\n", i); }else{ printf("%c is not digit.\n", i); } i = 'H'; if(isdigit(i)){ printf("%c is digit.\n", i); }else{ printf("%c is not digit.\n", i); } i = '$'; if(isdigit(i)){ printf("%c is digit.\n", i); }else{ printf("%c is not digit.\n", i); } return 0; }
1 is digit. H is not digit. $ is not digit.
isgraph : Alphanumeric
Source Code :Output :#include <stdio.h> #include <ctype.h> int main(){ char i; i = '1'; if(isgraph(i)){ printf("%c is graphical character.\n", i); }else{ printf("%c is not graphical character.\n", i); } i = 'H'; if(isgraph(i)){ printf("%c is graphical character.\n", i); }else{ printf("%c is not graphical character.\n", i); } i = '$'; if(isgraph(i)){ printf("%c is graphical character.\n", i); }else{ printf("%c is not graphical character.\n", i); } i = '\t'; if(isgraph(i)){ printf("%c is graphical character.\n", i); }else{ printf("%c is not graphical character.\n", i); } return 0; }
1 is graphical character. H is graphical character. $ is graphical character. is not graphical character.
islower : Alphanumeric
Source Code :Output :#include <stdio.h> #include <ctype.h> int main(){ char i; i = '1'; if(islower(i)){ printf("%c is lowercase character.\n", i); }else{ printf("%c is not lowercase character.\n", i); } i = 'H'; if(islower(i)){ printf("%c is lowercase character.\n", i); }else{ printf("%c is not lowercase character.\n", i); } i = 'h'; if(islower(i)){ printf("%c is lowercase character.\n", i); }else{ printf("%c is not lowercase character.\n", i); } i = '$'; if(islower(i)){ printf("%c is lowercase character.\n", i); }else{ printf("%c is not lowercase character.\n", i); } return 0; }
1 is not lowercase character. H is not lowercase character. h is lowercase character. $ is not lowercase character.
ispunct : Alphanumeric
Source Code :Output :#include <stdio.h> #include <ctype.h> int main(){ char i; i = '1'; if(ispunct(i)){ printf("%c is punctuation.\n", i); }else{ printf("%c is not punctuation.\n", i); } i = 'H'; if(ispunct(i)){ printf("%c is punctuation.\n", i); }else{ printf("%c is not punctuation.\n", i); } i = '"'; if(ispunct(i)){ printf("%c is punctuation.\n", i); }else{ printf("%c is not punctuation.\n", i); } i = '$'; if(ispunct(i)){ printf("%c is punctuation.\n", i); }else{ printf("%c is not punctuation.\n", i); } return 0; }
1 is not punctuation. H is not punctuation. " is punctuation. $ is punctuation.
isspace : Alphanumeric
Source Code :Output :#include <stdio.h> #include <ctype.h> int main(){ char i; i = '1'; if(isspace(i)){ printf("%c is space.\n", i); }else{ printf("%c is not space.\n", i); } i = 'H'; if(isspace(i)){ printf("%c is space.\n", i); }else{ printf("%c is not space.\n", i); } i = ' '; if(isspace(i)){ printf("%c is space.\n", i); }else{ printf("%c is not space.\n", i); } i = '$'; if(isspace(i)){ printf("%c is space.\n", i); }else{ printf("%c is not space.\n", i); } return 0; }
1 is not space. H is not space. is space. $ is not space.
isupper : Alphanumeric
Source Code :Output :#include <stdio.h> #include <ctype.h> int main(){ char i; i = '1'; if(isupper(i)){ printf("%c is uppercase character.\n", i); }else{ printf("%c is not uppercase character.\n", i); } i = 'H'; if(isupper(i)){ printf("%c is uppercase character.\n", i); }else{ printf("%c is not uppercase character.\n", i); } i = 'h'; if(isupper(i)){ printf("%c is uppercase character.\n", i); }else{ printf("%c is not uppercase character.\n", i); } return 0; }
1 is not uppercase character. H is uppercase character. h is not uppercase character.
isxdigit : Alphanumeric
Source Code :Output :#include <stdio.h> #include <ctype.h> int main(){ char i; i = '1'; if(isxdigit(i)){ printf("%c is hexadecimal.\n", i); }else{ printf("%c is not hexadecimal.\n", i); } i = '9f'; if(isxdigit(i)){ printf("%c is hexadecimal.\n", i); }else{ printf("%c is not hexadecimal.\n", i); } i = 'F'; if(isxdigit(i)){ printf("%c is hexadecimal.\n", i); }else{ printf("%c is not hexadecimal.\n", i); } i = 'h'; if(isxdigit(i)){ printf("%c is hexadecimal.\n", i); }else{ printf("%c is not hexadecimal.\n", i); } return 0; }
1 is hexadecimal. f is hexadecimal. F is hexadecimal. h is not hexadecimal.
tolower : Alphanumeric
Source Code :Output :#include <stdio.h> #include <ctype.h> int main(){ char i, lower; i = '1'; lower = tolower(i); printf("Converted in Lowercase : %c\n", lower); i = 'H'; lower = tolower(i); printf("Converted in Lowercase : %c\n", lower); i = 'h'; lower = tolower(i); printf("Converted in Lowercase : %c", lower); return 0; }
Converted in Lowercase : 1 Converted in Lowercase : h Converted in Lowercase : h
toupper : Alphanumeric
Source Code :Output :#include <stdio.h> #include <ctype.h> int main(){ char i, upper; i = '1'; upper = toupper(i); printf("Converted in uppercase : %c\n", upper); i = 'H'; upper = toupper(i); printf("Converted in uppercase : %c\n", upper); i = 'h'; upper = toupper(i); printf("Converted in uppercase : %c", upper); return 0; }
Converted in uppercase : 1 Converted in uppercase : H Converted in uppercase : H