Using functions islower, isupper, tolower, toupper : char function « Data Type « C Tutorial

Home
C Tutorial
1.Language
2.Data Type
3.String
4.printf scanf
5.Operator
6.Statement
7.Array
8.Function
9.Structure
10.Pointer
11.Memory
12.Preprocessor
13.File
14.Data Structure
15.Search Sort
16.Wide Character String
17.assert.h
18.ctype.h
19.math.h
20.setjmp.h
21.signal.h
22.stdio.h
23.stdlib.h
24.string.h
25.time.h
26.wctype.h
C / ANSI-C
C++
C++ Tutorial
Visual C++ .NET
C Tutorial » Data Type » char function 
2.15.1.Using functions islower, isupper, tolower, toupper
#include <stdio.h>
#include <ctype.h>

int main()

   printf"%s\n%s%s\n%s%s\n%s%s\n%s%s\n\n",
           "According to islower:",
           islower'p' "p is a " "p is not a ",
           "lowercase letter",
           islower'P' "P is a " "P is not a ",
           "lowercase letter",
           islower'5' "5 is a " "5 is not a ",
           "lowercase letter",
           islower'!' "! is a " "! is not a ",
           "lowercase letter" );

   printf"%s\n%s%s\n%s%s\n%s%s\n%s%s\n\n",
           "According to isupper:",
           isupper'D' "D is an " "D is not an ",
           "uppercase letter",
           isupper'd' "d is an " "d is not an ",
           "uppercase letter",
           isupper'8' "8 is an " "8 is not an ",
           "uppercase letter",
           isupper'$' "$ is an " "$ is not an ",
           "uppercase letter" );

   printf"%s%c\n%s%c\n%s%c\n%s%c\n",
           "u converted to uppercase is ", toupper'u' ),
           "7 converted to uppercase is ", toupper'7' ),
           "$ converted to uppercase is ", toupper'$' ),
           "L converted to lowercase is ", tolower'L' ) );

   return 0;

}
According to islower:
p is a lowercase letter
P is not a lowercase letter
5 is not a lowercase letter
! is not a lowercase letter

According to isupper:
D is an uppercase letter
d is not an uppercase letter
8 is not an uppercase letter
$ is not an uppercase letter

u converted to uppercase is U
7 converted to uppercase is 7
$ converted to uppercase is $
L converted to lowercase is l
2.15.char function
2.15.1.Using functions islower, isupper, tolower, toupper
2.15.2.Using functions isdigit, isalpha, isalnum, and isxdigit
2.15.3.Using functions isspace, iscntrl, ispunct, isprint, isgraph
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.