Standard library practical character processing functions

Header file: #include <cctype>

1. The following functions are used to determine letters:

  • std:: isspace ('0');//Whether it is a blank character (space, horizontal tab character'\t', vertical tab character'\v', line feed character'\n', page feed character'\f' , Carriage return character'\r')
  • std:: isalpha ('0');//whether it is a letter (not including the underscore'_')
  • std:: isdigit ('0');//Whether it is a decimal number ('0'~'9')
  • std:: isxdigit ('0');//Whether it is a hexadecimal number ('0'~'9','a'~'f','A'~'F')
  • std:: isupper ('0');//whether uppercase letters
  • std:: islower ('0');//whether lowercase letters
  • std:: isalnum ('0');//Is it a letter or number
  • std:: iscntrl ('0');//Whether to control characters (ASCII 0~31, 127)
  • std:: ispunct ('0');//whether letters, numbers, blanks, visible control characters
  • std:: isgraph ('0');//Whether letters, numbers, visible control characters (excluding white space)    
  • std:: isprint ('0');//Whether the displayed characters can be printed

2. Letter case

  • std:: toupper gets the uppercase of letters
  • std:: tolower gets lowercase letters

Guess you like

Origin blog.csdn.net/kenfan1647/article/details/114632743