Character type determining function comes STL

Lkislf

   

the isalpha () is used to determine whether a character is a letter, if the character is a non-zero return, otherwise, returns zero.

   

cout << isalpha ( 'a') ; // returns a nonzero

cout << isalpha ( '2') ; // returns 0

2.isalnum

   

isalnum () is used to determine whether a character is a number or letter, that is to say whether a character belongs to A ~ Z || A || the Z 0 ~ ~. 9 .

   

        cout << isalnum ( 'a') ; // nonzero output

cout << isalnum ( '2') ; // nonzero

cout << isalnum('.');//

3.islower

   

islower () is used to determine whether a lowercase character, i.e. whether A ~ Z .

   

cout << islower ( 'a') ; // nonzero

cout << islower ( '2') ; // Output 0

cout << islower ( 'A') ; // Output 0

4.isupper

   

isupper () and islower contrast, for whether a character is a capital letter.

   

        cout << isupper ( 'a') ; // returns 0

cout << isupper ( '2') ; // returns 0

cout << isupper ( 'A') ; // returns a nonzero

Note: The above are the macro definition, not a real function.

   

————————————————

Disclaimer: This article is CSDN blogger " AK original article Dragon", and follow CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.

Original link: https://blog.csdn.net/weixin_41162823/article/details/80172379

Guess you like

Origin www.cnblogs.com/xukaiae86/p/11857903.html