Explain the various character functions with example.
1. tolower()- this function convert a character to lower case.
Example : tolower(‘A’)=a
2. toupper()- this function converts a character to upper case.
Example : toupper(‘b’)=B
3. toascii()- this function converts character to its ascii equivalent. The output is an integer.
Example : toascii(‘a’)=65
4. isalpha()- this function checks if a given character is an alphabet or not.
Example : isalpha(‘a’)=true isalpha(‘*’)=false
5. isdigit()- checks if a given character is a digit or not.
Example : isdigit(‘8’)= true isdigit(‘I’)=false
6. isspace()- checks if a given character is a white space or not.
Example : isspace(‘ ‘)=true isspace(‘%’)=false
7. ispunct()- checks if a given character is a punctuation or not.
Example : ispunct(‘?’)=true ispunct(‘ “)=false
8. islower()-checks if a given character is in lower case or not.
Example : islower(‘a’)=true islower(‘L’)=false
9. isupper()-checks if a given character is in uppercase or not.
Example : isupper(‘M’)=true isupper(‘h’)=false
Thanks
Mukesh Rajput
Post A Comment:
0 comments: