std::ctype::toupper, std::ctype::do_toupper - cppreference.com (original) (raw)

| Defined in header | | | | ------------------------------------------------------------------------------------- | --- | | | public:CharT toupper( CharT c ) const; | (1) | | | public: const CharT* toupper( CharT* beg, const CharT* end ) const; | (2) | | | protected: virtual CharT do_toupper( CharT c ) const; | (3) | | | protected: virtual const CharT* do_toupper( CharT* beg, const CharT* end ) const; | (4) | |

1,2) Public member function, calls the protected virtual member function do_toupper of the most derived class.

  1. Converts the character c to upper case if an upper case form is defined by this locale.

  2. For every character in the character array [beg, end), for which an upper case form exists, replaces the character with that upper case form.

[edit] Parameters

c - character to convert
beg - pointer to the first character in an array of characters to convert
end - one past the end pointer for the array of characters to convert

[edit] Return value

1,3) Upper case character or c if no upper case form is listed by this locale.

2,4) end

[edit] Notes

Only 1:1 character mapping can be performed by this function, e.g. the uppercase form of 'ß' is the two-character string "SS" (with some exceptions - see «Capital ẞ»), which cannot be obtained by do_toupper.

[edit] Example

Output:

In US English UTF-8 locale: Upper case form of 's' is S Upper case form of 'ſ' is S Upper case form of 'δ' is Δ Upper case form of 'ö' is Ö 'ß' has no upper case form Uppercase form of the string 'Hello, World!' is 'HELLO, WORLD!'

[edit] See also