Those forgotten ype Functions

Source: Internet
Author: User
Tags uppercase character

These functions are defined in the header file of cctype.

Isalnum (c) true if C is a letter or number

Isalpha (c) returns true if C is a letter

Iscntrl (c) returns true if C is a control character

Isdigit (c) returns true if C is a number

Isgraph (c) returns true if C is not a space but can be printed.

Islower (c) returns true if C is lower case

Isprint (c) is printable and returns true

Ispunct (c) returns true if C is a punctuation character

Isspace (c) returns true if C is a blank character

Isupper (c) returns true if it is an uppercase character

Isxdigit (c) returns true if C is a hexadecimal number.

If tolower (c) is in upper case, convert it to lower case

If toupper (c) is in lower case, convert it to upper case

# Include <iostream> # include <string> # include <cctype> using namespace STD; int main () {string S = "aeld2o";/* For (string :: size_type I = 0; I <S. size (); I ++) {If (s [I]> '0' & S [I] <'9 ') {cout <"Number" <Endl; break ;}}for (string: size_type I = 0; I <S. length (); I ++) {If (isalnum (s [I]) {cout <s [I] <Endl ;}for (string :: size_type J = 0; j <S. size (); j ++) {If (isalpha (s [J]) {cout <s [J] <"" ;}} cout <Endl; for (string: size_type z = 0; Z <S. size (); Z ++) {If (isdigit (s [Z]) {cout <s [Z] <"" ;}} cout <Endl; for (string: size_type K = 0; k <S. size (); k ++) {If (isalpha (s [k]) {cout <(char) toupper (s [k]) <"";}} cout <Endl; return 0 ;}

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.