C++ string_wide_character_type

C++ string_wide_character_type

Wide character type i.e <cwctype>

This header under the String Library declares a set of functions to classify and transform individual wide characters.

The set of functions are :- 

1. Character classification functions

They check whether the character passed as parameter belongs to a certain category:

For eg: iswalnum


 Output: -



Similarly, we have other functions like :-

  • iswalpha         Checks if wide character is alphabetic 
  • iswblank         Checks if wide character is blank 
  • iswcntrl          Checks if wide character is a control character 
  • iswdigit          Checks if wide character is decimal digit 
  • iswgraph        Checks if wide character has graphical representation 
  • iswlower         Checks if wide character is lowercase letter 
  • iswprint          Checks if wide character is printable 
  • iswpunct        Checks if wide character is punctuation character 


Taking another example of iswpunct:-




2.  Character conversion functions

Two functions that convert between letter cases:

  • towlower     Converts uppercase wide character to lowercase 
  • towupper    Converts lowercase wide character to uppercase 


3.  Extensible classification/conversion function

  • iswctype     Checks if wide character has property 
  • towctrans   Converts using transformation 
  • wctrans      Returns character transformation 
  • wctype       Returns character property 

 Taking an example of towctrans :-