Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
ctype.cpp
Go to the documentation of this file.
1
29#include <iostream> // for cout, endl
30#include <locale> // for ctype
31
32#include <examples.h>
33
34int main ()
35{
36 std::locale loc;
37 char s [] = "blues Power";
38
39 // Get a reference to the ctype<char> facet.
40 const std::ctype<char>& ct = std::use_facet<std::ctype<char> >(loc);
41
42 // Check the classification of the 'a' character.
43 std::cout << ct.is (std::ctype_base::alpha, 'a') << std::endl;
44 std::cout << ct.is (std::ctype_base::punct, 'a') << std::endl;
45
46 // Scan for the first upper case character.
47 std::cout << *ct.scan_is (std::ctype_base::upper,
48 s, s + sizeof s / sizeof *s)
49 << std::endl;
50
51 // Convert characters to upper case.
52 (ct.toupper)(s, s + sizeof s / sizeof *s);
53 std::cout << s << std::endl;
54
55 return 0;
56}
#define loc
Definition 17.names.cpp:492
#define s
int main()
Definition ctype.cpp:34