-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIsAlphaLocale.cpp
More file actions
44 lines (32 loc) · 1.09 KB
/
IsAlphaLocale.cpp
File metadata and controls
44 lines (32 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* \file IsAlphaLocale.cpp
* \brief std::isalpha with locale
*/
#include <StdStream/StdStream.h>
#include <StdTest/StdTest.h>
#include <Stl.h>
//--------------------------------------------------------------------------------------------------
int main(int, char **)
{
// немецкая буква ß в ISO-8859-1
const unsigned char ch = '\xdf';
{
const auto is_alpha = static_cast<bool>( std::isalpha(ch) );
std::cout
<< "std::isalpha(\'\\xdf\', Locale: default C) - "
<< std::boolalpha << is_alpha << std::endl;
}
{
std::setlocale(LC_ALL, "de_DE.iso88591");
const auto is_alpha = static_cast<bool>( std::isalpha(ch) );
std::cout
<< "std::isalpha(\'\\xdf\', Locale: ISO-8859-1) - "
<< std::boolalpha << is_alpha << std::endl;
}
return EXIT_SUCCESS;
}
//--------------------------------------------------------------------------------------------------
#if OUTPUT
isalpha('\xdf', default C locale) - false
isalpha('\xdf', ISO-8859-1 locale) - false /// TODO: must be - true
#endif