std:: toupper (std::locale)
From cppreference.net
C++
Text processing library
| Localization library | |||||||||||||||||||||||||
| Regular expressions library (C++11) | |||||||||||||||||||||||||
| Formatting library (C++20) | |||||||||||||||||||||||||
| Null-terminated sequence utilities | |||||||||||||||||||||||||
| Byte strings | |||||||||||||||||||||||||
| Multibyte strings | |||||||||||||||||||||||||
| Wide strings | |||||||||||||||||||||||||
| Primitive numeric conversions | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
| Text encoding identifications | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
Localization library
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
헤더에 정의됨
<locale>
|
||
|
template
<
class
CharT
>
CharT toupper ( CharT ch, const locale & loc ) ; |
||
문자 ch 를 가능한 경우 대문자로 변환하며, 주어진 로캘의 std::ctype 패싯에 지정된 변환 규칙을 사용합니다.
목차 |
매개변수
| ch | - | character |
| loc | - | locale |
반환값
로캘에 목록된 대문자 형태가 있으면 ch 의 대문자 형태를 반환하고, 그렇지 않으면 ch 를 변경 없이 반환합니다.
참고 사항
이 함수는 오직 1:1 문자 매핑만 수행할 수 있습니다. 예를 들어, 'ß'의 대문자 형태는 (일부 예외를 제외하고) 두 문자 문자열 "SS"인데, 이것은 std::toupper 로 얻을 수 없습니다.
가능한 구현
template<class CharT> CharT toupper(CharT ch, const std::locale& loc) { return std::use_facet<std::ctype<CharT>>(loc).toupper(ch); } |
예제
이 코드 실행
#include <cwctype> #include <iostream> #include <locale> int main() { wchar_t c = L'\u017f'; // Latin small letter Long S ('ſ') std::cout << std::hex << std::showbase; std::cout << "in the default locale, toupper(" << (std::wint_t)c << ") = " << (std::wint_t)std::toupper(c, std::locale()) << '\n'; std::cout << "in Unicode locale, toupper(" << (std::wint_t)c << ") = " << (std::wint_t)std::toupper(c, std::locale("en_US.utf8")) << '\n'; }
가능한 출력:
in the default locale, toupper(0x17f) = 0x17f in Unicode locale, toupper(0x17f) = 0x53
참고 항목
로캘의
ctype
패싯을 사용하여 문자를 소문자로 변환
(함수 템플릿) |
|
|
문자를 대문자로 변환
(함수) |
|
|
와이드 문자를 대문자로 변환
(함수) |