std::ctype<CharT>:: tolower, std::ctype<CharT>:: do_tolower
From cppreference.net
|
헤더 파일에 정의됨
<locale>
|
||
|
public
:
CharT tolower ( CharT c ) const ; |
(1) | |
|
public
:
const CharT * tolower ( CharT * beg, const CharT * end ) const ; |
(2) | |
|
protected
:
virtual CharT do_tolower ( CharT c ) const ; |
(3) | |
|
protected
:
virtual const CharT * do_tolower ( CharT * beg, const CharT * end ) const ; |
(4) | |
1,2)
공용 멤버 함수로, 가장 파생된 클래스의 보호된 가상 멤버 함수
do_tolower
를 호출합니다.
3)
이 로캘에 의해 소문자 형태가 정의된 경우 문자
c
를 소문자로 변환합니다.
4)
문자 배열
[
beg
,
end
)
범위 내의 모든 문자에 대해, 소문자 형태가 존재하는 경우 해당 문자를 소문자 형태로 대체합니다.
목차 |
매개변수
| c | - | 변환할 문자 |
| beg | - | 변환할 문자 배열의 첫 번째 문자를 가리키는 포인터 |
| end | - | 변환할 문자 배열의 끝 다음을 가리키는 포인터 |
반환값
1,3)
소문자 문자 또는 이 로케일에서 소문자 형태가 나열되지 않은 경우
c
.
2,4)
end
참고 사항
이 함수는 1:1 문자 매핑만 수행할 수 있습니다. 예를 들어 그리스어 대문자 'Σ'는 단어 내 위치에 따라 두 가지 소문자 형태('σ'와 'ς')를 가집니다. 이런 경우
do_tolower
호출로 올바른 소문자 형태를 얻을 수 없습니다.
예제
이 코드 실행
#include <iostream> #include <locale> void try_lower(const std::ctype<wchar_t>& f, wchar_t c) { wchar_t up = f.tolower(c); if (up != c) std::wcout << "Lower case form of \'" << c << "' is " << up << '\n'; else std::wcout << '\'' << c << "' has no lower case form\n"; } int main() { std::locale::global(std::locale("en_US.utf8")); std::wcout.imbue(std::locale()); std::wcout << "In US English UTF-8 locale:\n"; auto& f = std::use_facet<std::ctype<wchar_t>>(std::locale()); try_lower(f, L'Σ'); try_lower(f, L'Ɛ'); try_lower(f, L'A'); std::wstring str = L"HELLo, wORLD!"; std::wcout << "Lowercase form of the string '" << str << "' is "; f.tolower(&str[0], &str[0] + str.size()); std::wcout << '\'' << str << "'\n"; }
출력:
In US English UTF-8 locale: Lower case form of 'Σ' is σ Lower case form of 'Ɛ' is ɛ Lower case form of 'A' is a Lowercase form of the string 'HELLo, wORLD!' is 'hello, world!'
참고 항목
do_toupper
를 호출합니다
(public member function) |
|
|
문자를 소문자로 변환합니다
(function) |
|
|
와이드 문자를 소문자로 변환합니다
(function) |