#include <xtd/console>
#include <xtd/environment>
#include <xtd/format>
enum class cap {title, middle, end};
if (c == cap::title)
console::out
<< "┌───────────┬────────────┬──────────────────────────────────┐" << environment::new_line
<< "│ char │ format │ representation │" << environment::new_line
<< "├───────────┼────────────┼──────────────────────────────────┤" << environment::new_line;
console::out <<
"│ " << text.pad_right(9) <<
" │ {} │ " << format(U
"{}", value).
pad_right(32) <<
" │" << environment::new_line;
console::out <<
"│ " << text.pad_right(9) <<
" │ {:g} │ " << format(U
"{:g}", value).
pad_right(32) <<
" │" << environment::new_line;
console::out <<
"│ " << text.pad_right(9) <<
" │ {:G} │ " << format(U
"{:G}", value).
pad_right(32) <<
" │" << environment::new_line;
console::out <<
"│ " << text.pad_right(9) <<
" │ {:d} │ " << format(U
"{:d}", value).
pad_right(32) <<
" │" << environment::new_line;
console::out <<
"│ " << text.pad_right(9) <<
" │ {:D} │ " << format(U
"{:D}", value).
pad_right(32) <<
" │" << environment::new_line;
console::out <<
"│ " << text.pad_right(9) <<
" │ {:x} │ " << format(U
"{:x}", value).
pad_right(32) <<
" │" << environment::new_line;
console::out <<
"│ " << text.pad_right(9) <<
" │ {:X} │ " << format(U
"{:X}", value).
pad_right(32) <<
" │" << environment::new_line;
console::out <<
"│ " << text.pad_right(9) <<
" │ {:ANY_FMT} │ " << format(U
"{:ANY_FMT}", value).
pad_right(32) <<
" │" << environment::new_line;
if (c != cap::end)
console::out << "├───────────┼────────────┼──────────────────────────────────┤" << environment::new_line;
else
console::out << "└───────────┴────────────┴──────────────────────────────────┘" << environment::new_line;
}
auto main() -> int {
console::output_code_page(65001);
print_character(string {"a"}, 'a', cap::title);
print_character(string {u8"1"}, u8'1', cap::middle);
print_character(string {L"\x1F603"}, L'\x1F603', cap::middle);
print_character(
string {
u"\u4eb0"},
u'\u4eb0', cap::middle);
print_character(string {U"\U0001F428"}, U'\U0001F428', cap::end);
}
Represents text as a sequence of character units.
Definition basic_string.hpp:79
basic_string pad_right(xtd::size total_width) const noexcept
Left-aligns the characters in this basic_string, padding with spaces on the right for a specified tot...
Definition basic_string.hpp:1597
char32_t char32
Represents a 32-bit unicode character.
Definition char32.hpp:26
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10