Character type judgment

1.isalpha

the isalpha () is used to determine whether a letter character, 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 determined a character belongs to a ~ z || a ~ Z || 0 ~ 9.

            cout << isalnum ( 'a') ; // nonzero output
        cout << isalnum ( '2') ; // zero
        cout << isalnum ( '.') ; // zero

3.islower

islower () is used to whether a character is a lowercase letter, i.e. whether a ~ z.

        cout << islower ( 'a') ; // zero
        cout << islower ( '2') ; // output 0
        COUT << islower ( 'A'); // output 0

4.isupper

isupper () and islower On the contrary, it used to determine whether a character is a capital letter.

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


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


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

Guess you like

Origin www.cnblogs.com/zhanghengyu/p/11294573.html