Overview
CRT provides set of functions to classify characters and changes their cases to upper or lower. Standard library also provides template based functions to provide the same facility.
Details
Character classification
These template functions are defined to classify characters based on locale.
Name | Description |
---|---|
bool isspace (CharT ch, const locale& loc ) | A whitespace character is skipped by istream classes while reading. In "C" locale, whitespace characters are ' ', '\t', '\n', '\v', '\f' and '\r' |
bool isprint (CharT ch, const locale& loc ) | A printable character is a character that occupies a printing position on a display. In "C" locale, printing characters are all with an ASCII code greater than 0x1f (US), except 0x7f (DEL). |
bool iscntrl (CharT ch, const locale& loc ) | A control character does not occupies a printing position on a display. In "C" locale, control characters are those between ASCII codes 0x00 (NUL) and 0x1f (US), plus 0x7f (DEL). |
bool isupper (CharT ch, const locale& loc ) | In "C" locale, uppercase characters are A B C D E F G H I J K L M N O P Q R S T U V W X Y Z. |
bool islower (CharT ch, const locale& loc ) | In "C" locale, lowercase characters are a b c d e f g h i j k l m n o p q r s t u v w x y z. |
bool isalpha (CharT ch, const locale& loc ) | In the default "C" locale, alpha characters are both uppercase and lowercase characters. |
bool isdigit (CharT ch, const locale& loc ) | In the default "C" locale, decimal digits are 0 1 2 3 4 5 6 7 8 9 |
bool ispunct (CharT ch, const locale& loc ) | The standard "C" locale, punctuation characters are all graphic characters that are not alphanumeric. |
bool isxdigit (CharT ch, const locale& loc ) | The standard "C" locale, hexadecimal digit characters are 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F |
bool isblank (CharT ch, const locale& loc ) | The standard "C" locale, blank characters are '\t' and ' '. |
bool isalnum (CharT ch, const locale& loc ) | The standard "C" locale, an alnum character is either an alphabet or a digit(alpha | digit). |
bool isgraph (CharT ch, const locale& loc ) | The standard "C" locale, a graph character is either an alphabet or a digit or a punctuation(alnum | punct) except space character. |
Character conversions
These template functions are defined to change case of characters based on locale.
Name | Description |
---|---|
CharT toupper (CharT ch, const locale& loc) | Converts the character ch to uppercase if possible, using the conversion rules specified by the given locale's std::ctype facet. Returns the uppercase form of ch if one is listed in the locale, otherwise returns ch unchanged. |
CharT tolower (CharT ch, const locale& loc) | Converts the character ch to lowercase if possible, using the conversion rules specified by the given locale's ctype facet. Returns the lowercase form of ch if one is listed in the locale, otherwise returns ch unchanged. |
No comments:
Post a Comment